本文整理匯總了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;
}
示例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;
}
示例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);
}
示例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);
}
示例5: register
import com.esotericsoftware.kryo.Kryo; //導入方法依賴的package包/類
public static void register(final Kryo kryo) {
kryo.addDefaultSerializer(URI.class, URISerializer.class);
}
示例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)));
}