本文整理汇总了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);
}
示例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));
}
示例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;
}
示例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;
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}