Java 类org.bson.BsonDocumentWrapper 实例源码

项目:cherimodata    文件:EntityInvocationHandler.java   
/**
 * stores the given EntityInvocationHandler represented Entity in the given Collection
 *
 * @param handler EntityInvocationHandler (Entity) to save
 * @param coll MongoCollection to save entity into
 */
@SuppressWarnings( "unchecked" )
static <T extends Entity> void save( EntityInvocationHandler handler, MongoCollection<T> coll )
{
    for ( ParameterProperty cpp : handler.properties.getValidationProperties() )
    {
        cpp.validate( handler.data.get( cpp.getMongoName() ) );
    }
    BsonDocumentWrapper wrapper = new BsonDocumentWrapper<>( handler.proxy,
        (org.bson.codecs.Encoder<Entity>) coll.getCodecRegistry().get( handler.properties.getEntityClass() ) );
    UpdateResult res = coll.updateOne(
        new BsonDocument( "_id",
            BsonDocumentWrapper.asBsonDocument( EntityCodec._obtainId( handler.proxy ), idRegistry ) ),
        new BsonDocument( "$set", wrapper ), new UpdateOptions() );
    if ( res.getMatchedCount() == 0 )
    {
        // TODO this seems too nasty, there must be a better way.for now live with it
        coll.insertOne( (T) handler.proxy );
    }
    handler.persist();
}
项目:mongodb-rdbms-sync    文件:SyncConnectionInfo.java   
@Override
public <TDocument> BsonDocument toBsonDocument(Class<TDocument> arg0,
        CodecRegistry codecRegistry) {
    System.out.println("toBsonDocument called");
    return new BsonDocumentWrapper<SyncConnectionInfo>(this,
            codecRegistry.get(SyncConnectionInfo.class));
}
项目:mongodb-rdbms-sync    文件:SyncUserSession.java   
@Override
public <TDocument> BsonDocument toBsonDocument(Class<TDocument> arg0,
        CodecRegistry codecRegistry) {
    return new BsonDocumentWrapper<SyncUserSession>(this,
            codecRegistry.get(SyncUserSession.class));
}
项目:mongodb-rdbms-sync    文件:SyncNode.java   
@Override
public <TDocument> BsonDocument toBsonDocument(Class<TDocument> arg0, CodecRegistry codecRegistry) {
    return new BsonDocumentWrapper<SyncNode>(this, codecRegistry.get(SyncNode.class));
}
项目:mongodb-rdbms-sync    文件:SyncUser.java   
@Override
public <TDocument> BsonDocument toBsonDocument(Class<TDocument> arg0,
        CodecRegistry codecRegistry) {
    return new BsonDocumentWrapper<SyncUser>(this,
            codecRegistry.get(SyncUser.class));
}
项目:mongodb-rdbms-sync    文件:SyncMap.java   
@Override
public <TDocument> BsonDocument toBsonDocument(Class<TDocument> arg0, CodecRegistry codecRegistry) {
    return new BsonDocumentWrapper<SyncMap>(this, codecRegistry.get(SyncMap.class));
}
项目:mongodb-rdbms-sync    文件:MongoToOracleMap.java   
@Override
public <TDocument> BsonDocument toBsonDocument(Class<TDocument> arg0, CodecRegistry codecRegistry) {
    return new BsonDocumentWrapper<MongoToOracleMap>(this, codecRegistry.get(MongoToOracleMap.class));
}
项目:mongodb-rdbms-sync    文件:OracleToMongoMap.java   
@Override
public <TDocument> BsonDocument toBsonDocument(Class<TDocument> arg0, CodecRegistry codecRegistry) {
    return new BsonDocumentWrapper<OracleToMongoMap>(this, codecRegistry.get(OracleToMongoMap.class));
}
项目:mongodb-rdbms-sync    文件:MongoToOracleEvent.java   
@Override
public <TDocument> BsonDocument toBsonDocument(Class<TDocument> arg0, CodecRegistry codecRegistry) {
    return new BsonDocumentWrapper<MongoToOracleEvent>(this, codecRegistry.get(MongoToOracleEvent.class));
}
项目:mongodb-rdbms-sync    文件:SyncError.java   
@Override
public <TDocument> BsonDocument toBsonDocument(Class<TDocument> arg0, CodecRegistry codecRegistry) {
    return new BsonDocumentWrapper<SyncError>(this, codecRegistry.get(SyncError.class));
}
项目:mongodb-rdbms-sync    文件:OracleToMongoEvent.java   
@Override
public <TDocument> BsonDocument toBsonDocument(Class<TDocument> arg0, CodecRegistry codecRegistry) {
    return new BsonDocumentWrapper<OracleToMongoEvent>(this, codecRegistry.get(OracleToMongoEvent.class));
}
项目:mongodb-rdbms-sync    文件:SyncEvent.java   
@SuppressWarnings("rawtypes")
@Override
public <TDocument> BsonDocument toBsonDocument(Class<TDocument> arg0, CodecRegistry codecRegistry) {
    return new BsonDocumentWrapper<SyncEvent>(this, codecRegistry.get(SyncEvent.class));
}
项目:mongodb-rdbms-sync    文件:SyncMarker.java   
@Override
public <TDocument> BsonDocument toBsonDocument(Class<TDocument> arg0, CodecRegistry codecRegistry) {
    return new BsonDocumentWrapper<SyncMarker>(this, codecRegistry.get(SyncMarker.class));
}
项目:polymorphia    文件:IdGenerator.java   
default BsonValue asBsonValue(T id, TypeCodecRegistry typeCodecRegistry) {
    return BsonDocumentWrapper.asBsonDocument(id, typeCodecRegistry.getRegistry());
}
项目:verbum-domini    文件:ChapterBeanImpl.java   
@Override
public <TDocument> BsonDocument toBsonDocument(Class<TDocument> documentClass, CodecRegistry codecRegistry) {
    return new BsonDocumentWrapper<ChapterBeanImpl>(this, codecRegistry.get(ChapterBeanImpl.class));
}
项目:verbum-domini    文件:AnnotationBeanImpl.java   
@Override
public <TDocument> BsonDocument toBsonDocument(Class<TDocument> documentClass, CodecRegistry codecRegistry) {
    return new BsonDocumentWrapper<AnnotationBeanImpl>(this, codecRegistry.get(AnnotationBeanImpl.class));
}
项目:verbum-domini    文件:UserBeanImpl.java   
@Override
public <TDocument> BsonDocument toBsonDocument(Class<TDocument> documentClass, CodecRegistry codecRegistry) {
    return new BsonDocumentWrapper<UserBeanImpl>(this, codecRegistry.get(UserBeanImpl.class));
}
项目:verbum-domini    文件:BibleBeanImpl.java   
@Override
public <TDocument> BsonDocument toBsonDocument(Class<TDocument> documentClass, CodecRegistry codecRegistry) {
    return new BsonDocumentWrapper<BibleBeanImpl>(this, codecRegistry.get(BibleBeanImpl.class));
}
项目:verbum-domini    文件:BookBeanImpl.java   
@Override
public <TDocument> BsonDocument toBsonDocument(Class<TDocument> documentClass, CodecRegistry codecRegistry) {
    return new BsonDocumentWrapper<BookBeanImpl>(this, codecRegistry.get(BookBeanImpl.class));
}
项目:verbum-domini    文件:VerseBeanImpl.java   
@Override
public <TDocument> BsonDocument toBsonDocument(Class<TDocument> documentClass, CodecRegistry codecRegistry) {
    return new BsonDocumentWrapper<VerseBeanImpl>(this, codecRegistry.get(VerseBeanImpl.class));
}
项目:vertx-mongo-client    文件:JsonObjectBsonAdapter.java   
@Override
public <C> BsonDocument toBsonDocument(Class<C> documentClass, CodecRegistry codecRegistry) {
  return new BsonDocumentWrapper<>(obj, codecRegistry.get(JsonObject.class));
}
项目:lambdamatic-project    文件:BsonUtils.java   
/**
 * Converts the given {@link Object} into a {@link BsonDocument} using the registered
 * {@link Codec} in the {@link CodecRegistry}.
 * 
 * @param expression the object to convert
 * @return the corresponding {@link BsonDocument} or <code>null</code>
 */
public static BsonDocument asBsonDocument(final Object expression) {
  return BsonDocumentWrapper.asBsonDocument(expression, codecRegistry);
}