Java 类org.bson.assertions.Assertions 实例源码

项目:mongo-mapper    文件:EntityCodec.java   
public EntityCodec(Class<T> clazz, EntityInfo info) {
    this.clazz = clazz;
    this.info = info;
    idGenerator = Assertions.notNull("idGenerator", new ObjectIdGenerator());
    registry = CodecRegistries.fromProviders(MongoMapper.getProviders());
    documentCodec = new DocumentCodec(registry, new BsonTypeClassMap());
    bsonTypeClassMap = new BsonTypeClassMap();
}
项目:bsoneer    文件:BaseBsoneerCodec.java   
/**
 * Construct a new instance with the given registry
 *
 * @param registry {@link org.bson.codecs.configuration.CodecRegistry} to be used
 * @param idGenerator {@link org.bson.codecs.IdGenerator} to be used
 */
public BaseBsoneerCodec(final CodecRegistry registry, final IdGenerator generator) {
    this.registry = Assertions.notNull("registry", registry);
    this.idGenerator = Assertions.notNull("idGenerator",
            generator);
    defaultReader = DefaultReader.get(registry);
    setupSetters();
}
项目:bsoncodec-apt    文件:CodecCodeGenerator.java   
private void addConstructor(Builder classBuilder) {
    if (this.instanceFields.isEmpty()) {
        return;
    }

    MethodSpec.Builder constructor = MethodSpec.constructorBuilder()
            .addModifiers(Modifier.PUBLIC);

    if (this.instanceFields.stream()
            .filter(i -> i.isRegistryCodec() || i.isRegistry()).findAny()
            .isPresent()) {
        constructor.addParameter(ClassName.get(CodecRegistry.class), "registry",
                Modifier.FINAL);
    }

    for (InstanceField instanceField : this.instanceFields) {
        if (instanceField.isRegistryCodec()) {
            constructor.addStatement(
                    "this.$N = $T.notNull($S, registry.get($T.class))",
                    instanceField.name(), Assertions.class, instanceField.name(),
                    instanceField.codecForClass());
        }
        else {
            if (!instanceField.isRegistry()) {
                constructor.addParameter(instanceField.type(), instanceField.name(),
                        Modifier.FINAL);
            }
            constructor.addStatement("this.$N = $T.notNull($S, $N)",
                    instanceField.name(), Assertions.class, instanceField.name(),
                    instanceField.name());
        }
    }

    classBuilder.addMethod(constructor.build());

}
项目:bsoncodec-apt    文件:SimpleCodec.java   
public SimpleCodec(final ObjectIdGenerator objectIdGenerator) {
  this.objectIdGenerator = Assertions.notNull("objectIdGenerator", objectIdGenerator);
}