當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。