当前位置: 首页>>代码示例>>Java>>正文


Java CodecRegistry.get方法代码示例

本文整理汇总了Java中org.bson.codecs.configuration.CodecRegistry.get方法的典型用法代码示例。如果您正苦于以下问题:Java CodecRegistry.get方法的具体用法?Java CodecRegistry.get怎么用?Java CodecRegistry.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bson.codecs.configuration.CodecRegistry的用法示例。


在下文中一共展示了CodecRegistry.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: get

import org.bson.codecs.configuration.CodecRegistry; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public <T> Codec<T> get(Class<T> clazz, CodecRegistry registry) {
    // Optimistic get to avoid using dynamic memory
    Codec<?> ret = codecs.get(clazz);
    if (ret != null) {
        return (Codec<T>) ret;
    }
    if (clazz.isEnum()) {
        return (Codec<T>) codecs.computeIfAbsent(clazz, c -> new EnumCodec<>((Class<? extends Enum>) c));
    }
    if (clazz.isArray()) {
        Class<?> componentType = clazz.getComponentType();
        Codec componentCodec = get(componentType, registry);
        if (componentCodec != null) {
            return (Codec<T>) codecs.computeIfAbsent(clazz, c -> new ArrayCodec(clazz, componentCodec));
        }
    }
    return registry.get(clazz);
}
 
开发者ID:egopulse,项目名称:java-code-gen,代码行数:21,代码来源:ExtraCodecProvider.java

示例2: toBsonDocument

import org.bson.codecs.configuration.CodecRegistry; //导入方法依赖的package包/类
@Override
public <TDocument> BsonDocument toBsonDocument(Class<TDocument> arg0,
		CodecRegistry codecRegistry) {
	System.out.println("toBsonDocument called");
	return new BsonDocumentWrapper<SyncConnectionInfo>(this,
			codecRegistry.get(SyncConnectionInfo.class));
}
 
开发者ID:gagoyal01,项目名称:mongodb-rdbms-sync,代码行数:8,代码来源:SyncConnectionInfo.java

示例3: JacksonCodec

import org.bson.codecs.configuration.CodecRegistry; //导入方法依赖的package包/类
public JacksonCodec(ObjectMapper bsonObjectMapper,
                    CodecRegistry codecRegistry,
                    Class<T> type) {
    this.bsonObjectMapper = bsonObjectMapper;
    this.rawBsonDocumentCodec = codecRegistry.get(RawBsonDocument.class);
    this.type = type;
}
 
开发者ID:ylemoigne,项目名称:mongo-jackson-codec,代码行数:8,代码来源:JacksonCodec.java

示例4: onEnable

import org.bson.codecs.configuration.CodecRegistry; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void onEnable() {
    saveDefaultConfig();

    CodecRegistry codecRegistry = createCodecRegistry();
    MongoClientSettings settings = MongoClientSettings.builder()
            .clusterSettings(ClusterSettings.builder().applyConnectionString(new ConnectionString(getConfig().getString("mongodb.uri"))).build())
            .codecRegistry(codecRegistry)
            .build();
    client = MongoClients.create(settings);
    MongoDatabase database = client.getDatabase(getConfig().getString("mongodb.database"));
    if (!testConnection(database))
        return;
    RegionStorageAdapter storageAdapter = new RegionStorageAdapter(database);
    MongoRegionDriver driver = new MongoRegionDriver(getServer(), storageAdapter);

    WorldGuardPlugin wgPlugin = WorldGuardPlugin.inst();
    if (getConfig().getBoolean("mongodb.use_oplog")) {
        getLogger().info("OpLog usage enabled.");
        WorldGuardOpLogHandler opLogHandler = new WorldGuardOpLogHandler(codecRegistry.get(ProcessingProtectedRegion.class), storageAdapter, wgPlugin);
        getServer().getScheduler().runTaskAsynchronously(this, new OpLogRetriever(
                OpLogUtils.getCollection(client),
                new OpLogParser(opLogHandler),
                getConfig().getString("mongodb.database") + "." + RegionStorageAdapter.COLLECTION_NAME
        ));
        storageAdapter.setListener(opLogHandler);
    }

    ConfigurationManager config = wgPlugin.getGlobalStateManager();
    RegionContainer container = wgPlugin.getRegionContainer();
    InjectionUtils.injectRegionDriver(container, driver);
    InjectionUtils.callUnload(container);
    InjectionUtils.callLoadWorlds(container);
    config.selectedRegionStoreDriver = driver;
}
 
开发者ID:maxikg,项目名称:mongowg,代码行数:39,代码来源:MongoWGPlugin.java

示例5: toBsonDocument

import org.bson.codecs.configuration.CodecRegistry; //导入方法依赖的package包/类
@Override
public <TDocument> BsonDocument toBsonDocument(Class<TDocument> arg0,
		CodecRegistry codecRegistry) {
	return new BsonDocumentWrapper<SyncUserSession>(this,
			codecRegistry.get(SyncUserSession.class));
}
 
开发者ID:gagoyal01,项目名称:mongodb-rdbms-sync,代码行数:7,代码来源:SyncUserSession.java

示例6: toBsonDocument

import org.bson.codecs.configuration.CodecRegistry; //导入方法依赖的package包/类
@Override
public <TDocument> BsonDocument toBsonDocument(Class<TDocument> arg0, CodecRegistry codecRegistry) {
	return new BsonDocumentWrapper<SyncNode>(this, codecRegistry.get(SyncNode.class));
}
 
开发者ID:gagoyal01,项目名称:mongodb-rdbms-sync,代码行数:5,代码来源:SyncNode.java

示例7: toBsonDocument

import org.bson.codecs.configuration.CodecRegistry; //导入方法依赖的package包/类
@Override
public <TDocument> BsonDocument toBsonDocument(Class<TDocument> arg0,
		CodecRegistry codecRegistry) {
	return new BsonDocumentWrapper<SyncUser>(this,
			codecRegistry.get(SyncUser.class));
}
 
开发者ID:gagoyal01,项目名称:mongodb-rdbms-sync,代码行数:7,代码来源:SyncUser.java

示例8: toBsonDocument

import org.bson.codecs.configuration.CodecRegistry; //导入方法依赖的package包/类
@Override
public <TDocument> BsonDocument toBsonDocument(Class<TDocument> arg0, CodecRegistry codecRegistry) {
	return new BsonDocumentWrapper<SyncMap>(this, codecRegistry.get(SyncMap.class));
}
 
开发者ID:gagoyal01,项目名称:mongodb-rdbms-sync,代码行数:5,代码来源:SyncMap.java

示例9: toBsonDocument

import org.bson.codecs.configuration.CodecRegistry; //导入方法依赖的package包/类
@Override
public <TDocument> BsonDocument toBsonDocument(Class<TDocument> arg0, CodecRegistry codecRegistry) {
	return new BsonDocumentWrapper<MongoToOracleMap>(this, codecRegistry.get(MongoToOracleMap.class));
}
 
开发者ID:gagoyal01,项目名称:mongodb-rdbms-sync,代码行数:5,代码来源:MongoToOracleMap.java

示例10: toBsonDocument

import org.bson.codecs.configuration.CodecRegistry; //导入方法依赖的package包/类
@Override
public <TDocument> BsonDocument toBsonDocument(Class<TDocument> arg0, CodecRegistry codecRegistry) {
	return new BsonDocumentWrapper<OracleToMongoMap>(this, codecRegistry.get(OracleToMongoMap.class));
}
 
开发者ID:gagoyal01,项目名称:mongodb-rdbms-sync,代码行数:5,代码来源:OracleToMongoMap.java

示例11: toBsonDocument

import org.bson.codecs.configuration.CodecRegistry; //导入方法依赖的package包/类
@Override
public <TDocument> BsonDocument toBsonDocument(Class<TDocument> arg0, CodecRegistry codecRegistry) {
	return new BsonDocumentWrapper<MongoToOracleEvent>(this, codecRegistry.get(MongoToOracleEvent.class));
}
 
开发者ID:gagoyal01,项目名称:mongodb-rdbms-sync,代码行数:5,代码来源:MongoToOracleEvent.java

示例12: toBsonDocument

import org.bson.codecs.configuration.CodecRegistry; //导入方法依赖的package包/类
@Override
public <TDocument> BsonDocument toBsonDocument(Class<TDocument> arg0, CodecRegistry codecRegistry) {
	return new BsonDocumentWrapper<SyncError>(this, codecRegistry.get(SyncError.class));
}
 
开发者ID:gagoyal01,项目名称:mongodb-rdbms-sync,代码行数:5,代码来源:SyncError.java

示例13: toBsonDocument

import org.bson.codecs.configuration.CodecRegistry; //导入方法依赖的package包/类
@Override
public <TDocument> BsonDocument toBsonDocument(Class<TDocument> arg0, CodecRegistry codecRegistry) {
	return new BsonDocumentWrapper<OracleToMongoEvent>(this, codecRegistry.get(OracleToMongoEvent.class));
}
 
开发者ID:gagoyal01,项目名称:mongodb-rdbms-sync,代码行数:5,代码来源:OracleToMongoEvent.java

示例14: toBsonDocument

import org.bson.codecs.configuration.CodecRegistry; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public <TDocument> BsonDocument toBsonDocument(Class<TDocument> arg0, CodecRegistry codecRegistry) {
	return new BsonDocumentWrapper<SyncEvent>(this, codecRegistry.get(SyncEvent.class));
}
 
开发者ID:gagoyal01,项目名称:mongodb-rdbms-sync,代码行数:6,代码来源:SyncEvent.java

示例15: toBsonDocument

import org.bson.codecs.configuration.CodecRegistry; //导入方法依赖的package包/类
@Override
public <TDocument> BsonDocument toBsonDocument(Class<TDocument> arg0, CodecRegistry codecRegistry) {
	return new BsonDocumentWrapper<SyncMarker>(this, codecRegistry.get(SyncMarker.class));
}
 
开发者ID:gagoyal01,项目名称:mongodb-rdbms-sync,代码行数:5,代码来源:SyncMarker.java


注:本文中的org.bson.codecs.configuration.CodecRegistry.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。