本文整理匯總了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));
}