當前位置: 首頁>>代碼示例>>Java>>正文


Java Kryo.addDefaultSerializer方法代碼示例

本文整理匯總了Java中com.esotericsoftware.kryo.Kryo.addDefaultSerializer方法的典型用法代碼示例。如果您正苦於以下問題:Java Kryo.addDefaultSerializer方法的具體用法?Java Kryo.addDefaultSerializer怎麽用?Java Kryo.addDefaultSerializer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.esotericsoftware.kryo.Kryo的用法示例。


在下文中一共展示了Kryo.addDefaultSerializer方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createKryoInstance

import com.esotericsoftware.kryo.Kryo; //導入方法依賴的package包/類
private Kryo createKryoInstance() {
    Kryo kryo = new Kryo();

    kryo.register(RakTable.class);
    kryo.setDefaultSerializer(CompatibleFieldSerializer.class);
    kryo.setReferences(false);

    kryo.register(Collections.singletonList("").getClass(), new ArraysAsListSerializer());
    UnmodifiableCollectionsSerializer.registerSerializers(kryo);
    SynchronizedCollectionsSerializer.registerSerializers(kryo);
    kryo.addDefaultSerializer(new ArrayList<>().subList(0, 0).getClass(), new CollectionSerializer());
    kryo.addDefaultSerializer(new LinkedList<>().subList(0, 0).getClass(), new CollectionSerializer());
    kryo.register(UUID.class, new UUIDSerializer());

    for (Class<?> clazz : mCustomSerializers.keySet()) {
        kryo.register(clazz, mCustomSerializers.get(clazz));
    }

    kryo.setInstantiatorStrategy(
            new Kryo.DefaultInstantiatorStrategy(new StdInstantiatorStrategy()));

    return kryo;
}
 
開發者ID:isfaaghyth,項目名稱:Rak,代碼行數:24,代碼來源:PlainData.java

示例2: initialValue

import com.esotericsoftware.kryo.Kryo; //導入方法依賴的package包/類
@Override
protected Kryo initialValue() {
	Kryo kryo = new Kryo();
	SensorMeasurementInternalSerializer sensorInternal = new SensorMeasurementInternalSerializer();
	HSMMeasurementInternalSerializer hsmInternal = new HSMMeasurementInternalSerializer();

	kryo.addDefaultSerializer(HSMMeasurement.class, hsmInternal);
	kryo.addDefaultSerializer(SensorMeasurement.class, sensorInternal);
	kryo.addDefaultSerializer(SensorMeasurement1D.class, sensorInternal);
	kryo.addDefaultSerializer(SensorMeasurement2D.class, sensorInternal);
	return kryo;
}
 
開發者ID:proteus-h2020,項目名稱:proteus-consumer-couchbase,代碼行數:13,代碼來源:ProteusSerializer.java

示例3: register

import com.esotericsoftware.kryo.Kryo; //導入方法依賴的package包/類
public static void register(final Kryo kryo) {
  final EnumSerializer enumSerializer = new EnumSerializer();
  kryo.addDefaultSerializer(BindableConvention.class, enumSerializer);
  kryo.addDefaultSerializer(EnumerableConvention.class, enumSerializer);
  kryo.addDefaultSerializer(InterpretableConvention.class, enumSerializer);
  kryo.addDefaultSerializer(Convention.Impl.class, ConventionSerializer.class);

  kryo.addDefaultSerializer(RelDistributions.SINGLETON.getClass(), RelDistributionSerializer.class);
  kryo.addDefaultSerializer(DistributionTrait.class, DistributionTraitSerializer.class);
  kryo.addDefaultSerializer(RelCollation.class, RelCollationSerializer.class);

  kryo.addDefaultSerializer(RelTraitSet.class, RelTraitSetSerializer.class);
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:14,代碼來源:RelTraitSerializers.java

示例4: register

import com.esotericsoftware.kryo.Kryo; //導入方法依賴的package包/類
public static void register(final Kryo kryo) {
  // register list
  ImmutableListSerializer.register(kryo);
  // register set
  ImmutableSetSerializer.register(kryo);
  // register set
  ImmutableMapSerializer.register(kryo);
  // others
  kryo.addDefaultSerializer(FlatLists.AbstractFlatList.class, FieldSerializer.class);
  kryo.addDefaultSerializer(ImmutableNullableList.class, ImmutableNullableListSerializer.class);
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:12,代碼來源:ImmutableCollectionSerializers.java

示例5: register

import com.esotericsoftware.kryo.Kryo; //導入方法依賴的package包/類
public static void register(final Kryo kryo) {
  kryo.addDefaultSerializer(URI.class, URISerializer.class);
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:4,代碼來源:JavaSerializers.java

示例6: register

import com.esotericsoftware.kryo.Kryo; //導入方法依賴的package包/類
public static void register(final Kryo kryo) {
  kryo.addDefaultSerializer(RelCollationTraitDef.class, SingletonSerializer.of(Suppliers.ofInstance(RelCollationTraitDef.INSTANCE)));
  kryo.addDefaultSerializer(DistributionTraitDef.class, SingletonSerializer.of(Suppliers.ofInstance(DistributionTraitDef.INSTANCE)));
  kryo.addDefaultSerializer(RelDistributionTraitDef.class, SingletonSerializer.of(Suppliers.ofInstance(RelDistributionTraitDef.INSTANCE)));
  kryo.addDefaultSerializer(ConventionTraitDef.class, SingletonSerializer.of(Suppliers.ofInstance(ConventionTraitDef.INSTANCE)));
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:7,代碼來源:RelTraitDefSerializers.java


注:本文中的com.esotericsoftware.kryo.Kryo.addDefaultSerializer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。