当前位置: 首页>>代码示例>>Java>>正文


Java TreeMapSerializer类代码示例

本文整理汇总了Java中com.esotericsoftware.kryo.serializers.DefaultSerializers.TreeMapSerializer的典型用法代码示例。如果您正苦于以下问题:Java TreeMapSerializer类的具体用法?Java TreeMapSerializer怎么用?Java TreeMapSerializer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TreeMapSerializer类属于com.esotericsoftware.kryo.serializers.DefaultSerializers包,在下文中一共展示了TreeMapSerializer类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Kryo

import com.esotericsoftware.kryo.serializers.DefaultSerializers.TreeMapSerializer; //导入依赖的package包/类
/** @param referenceResolver May be null to disable references. */
public Kryo (ClassResolver classResolver, ReferenceResolver referenceResolver, StreamFactory streamFactory) {
	if (classResolver == null) throw new IllegalArgumentException("classResolver cannot be null.");

	this.classResolver = classResolver;
	classResolver.setKryo(this);

	this.streamFactory = streamFactory;
	streamFactory.setKryo(this);

	this.referenceResolver = referenceResolver;
	if (referenceResolver != null) {
		referenceResolver.setKryo(this);
		references = true;
	}

	addDefaultSerializer(byte[].class, ByteArraySerializer.class);
	addDefaultSerializer(char[].class, CharArraySerializer.class);
	addDefaultSerializer(short[].class, ShortArraySerializer.class);
	addDefaultSerializer(int[].class, IntArraySerializer.class);
	addDefaultSerializer(long[].class, LongArraySerializer.class);
	addDefaultSerializer(float[].class, FloatArraySerializer.class);
	addDefaultSerializer(double[].class, DoubleArraySerializer.class);
	addDefaultSerializer(boolean[].class, BooleanArraySerializer.class);
	addDefaultSerializer(String[].class, StringArraySerializer.class);
	addDefaultSerializer(Object[].class, ObjectArraySerializer.class);
	addDefaultSerializer(KryoSerializable.class, KryoSerializableSerializer.class);
	addDefaultSerializer(BigInteger.class, BigIntegerSerializer.class);
	addDefaultSerializer(BigDecimal.class, BigDecimalSerializer.class);
	addDefaultSerializer(Class.class, ClassSerializer.class);
	addDefaultSerializer(Date.class, DateSerializer.class);
	addDefaultSerializer(Enum.class, EnumSerializer.class);
	addDefaultSerializer(EnumSet.class, EnumSetSerializer.class);
	addDefaultSerializer(Currency.class, CurrencySerializer.class);
	addDefaultSerializer(StringBuffer.class, StringBufferSerializer.class);
	addDefaultSerializer(StringBuilder.class, StringBuilderSerializer.class);
	addDefaultSerializer(Collections.EMPTY_LIST.getClass(), CollectionsEmptyListSerializer.class);
	addDefaultSerializer(Collections.EMPTY_MAP.getClass(), CollectionsEmptyMapSerializer.class);
	addDefaultSerializer(Collections.EMPTY_SET.getClass(), CollectionsEmptySetSerializer.class);
	addDefaultSerializer(Collections.singletonList(null).getClass(), CollectionsSingletonListSerializer.class);
	addDefaultSerializer(Collections.singletonMap(null, null).getClass(), CollectionsSingletonMapSerializer.class);
	addDefaultSerializer(Collections.singleton(null).getClass(), CollectionsSingletonSetSerializer.class);
	addDefaultSerializer(TreeSet.class, TreeSetSerializer.class);
	addDefaultSerializer(Collection.class, CollectionSerializer.class);
	addDefaultSerializer(TreeMap.class, TreeMapSerializer.class);
	addDefaultSerializer(Map.class, MapSerializer.class);
	addDefaultSerializer(TimeZone.class, TimeZoneSerializer.class);
	addDefaultSerializer(Calendar.class, CalendarSerializer.class);
	addDefaultSerializer(Locale.class, LocaleSerializer.class);
	lowPriorityDefaultSerializerCount = defaultSerializers.size();

	// Primitives and string. Primitive wrappers automatically use the same registration as primitives.
	register(int.class, new IntSerializer());
	register(String.class, new StringSerializer());
	register(float.class, new FloatSerializer());
	register(boolean.class, new BooleanSerializer());
	register(byte.class, new ByteSerializer());
	register(char.class, new CharSerializer());
	register(short.class, new ShortSerializer());
	register(long.class, new LongSerializer());
	register(double.class, new DoubleSerializer());
	register(void.class, new VoidSerializer());
	
	// Lambdas support
	// Enable only if JVM supports it
	try {
		String version = System.getProperty("java.version");
		char minor = version.charAt(2);
		if (minor >= '8') {
			register(Class.forName("java.lang.invoke.SerializedLambda"));
			register(Closure.class, (Serializer)Class.forName("com.esotericsoftware.kryo.serializers.ClosureSerializer")
				.newInstance());
		}
	} catch (Exception e) {
		Log.trace("Serialization of Java8 lambdas is not available on this system.");
	}
}
 
开发者ID:HoratiusTang,项目名称:EsperDist,代码行数:78,代码来源:Kryo.java

示例2: Kryo

import com.esotericsoftware.kryo.serializers.DefaultSerializers.TreeMapSerializer; //导入依赖的package包/类
/** @param referenceResolver May be null to disable references. */
public Kryo (ClassResolver classResolver, ReferenceResolver referenceResolver, StreamFactory streamFactory) {
	if (classResolver == null) throw new IllegalArgumentException("classResolver cannot be null.");

	this.classResolver = classResolver;
	classResolver.setKryo(this);

	this.streamFactory = streamFactory;
	streamFactory.setKryo(this);

	this.referenceResolver = referenceResolver;
	if (referenceResolver != null) {
		referenceResolver.setKryo(this);
		references = true;
	}

	addDefaultSerializer(byte[].class, ByteArraySerializer.class);
	addDefaultSerializer(char[].class, CharArraySerializer.class);
	addDefaultSerializer(short[].class, ShortArraySerializer.class);
	addDefaultSerializer(int[].class, IntArraySerializer.class);
	addDefaultSerializer(long[].class, LongArraySerializer.class);
	addDefaultSerializer(float[].class, FloatArraySerializer.class);
	addDefaultSerializer(double[].class, DoubleArraySerializer.class);
	addDefaultSerializer(boolean[].class, BooleanArraySerializer.class);
	addDefaultSerializer(String[].class, StringArraySerializer.class);
	addDefaultSerializer(Object[].class, ObjectArraySerializer.class);
	addDefaultSerializer(KryoSerializable.class, KryoSerializableSerializer.class);
	addDefaultSerializer(BigInteger.class, BigIntegerSerializer.class);
	addDefaultSerializer(BigDecimal.class, BigDecimalSerializer.class);
	addDefaultSerializer(Class.class, ClassSerializer.class);
	addDefaultSerializer(Date.class, DateSerializer.class);
	addDefaultSerializer(Enum.class, EnumSerializer.class);
	addDefaultSerializer(EnumSet.class, EnumSetSerializer.class);
	addDefaultSerializer(Currency.class, CurrencySerializer.class);
	addDefaultSerializer(StringBuffer.class, StringBufferSerializer.class);
	addDefaultSerializer(StringBuilder.class, StringBuilderSerializer.class);
	addDefaultSerializer(Collections.EMPTY_LIST.getClass(), CollectionsEmptyListSerializer.class);
	addDefaultSerializer(Collections.EMPTY_MAP.getClass(), CollectionsEmptyMapSerializer.class);
	addDefaultSerializer(Collections.EMPTY_SET.getClass(), CollectionsEmptySetSerializer.class);
	addDefaultSerializer(Collections.singletonList(null).getClass(), CollectionsSingletonListSerializer.class);
	addDefaultSerializer(Collections.singletonMap(null, null).getClass(), CollectionsSingletonMapSerializer.class);
	addDefaultSerializer(Collections.singleton(null).getClass(), CollectionsSingletonSetSerializer.class);
	addDefaultSerializer(TreeSet.class, TreeSetSerializer.class);
	addDefaultSerializer(Collection.class, CollectionSerializer.class);
	addDefaultSerializer(TreeMap.class, TreeMapSerializer.class);
	addDefaultSerializer(Map.class, MapSerializer.class);
	addDefaultSerializer(TimeZone.class, TimeZoneSerializer.class);
	addDefaultSerializer(Calendar.class, CalendarSerializer.class);
	addDefaultSerializer(Locale.class, LocaleSerializer.class);
	lowPriorityDefaultSerializerCount = defaultSerializers.size();

	// Primitives and string. Primitive wrappers automatically use the same registration as primitives.
	register(int.class, new IntSerializer());
	register(String.class, new StringSerializer());
	register(float.class, new FloatSerializer());
	register(boolean.class, new BooleanSerializer());
	register(byte.class, new ByteSerializer());
	register(char.class, new CharSerializer());
	register(short.class, new ShortSerializer());
	register(long.class, new LongSerializer());
	register(double.class, new DoubleSerializer());
	register(void.class, new VoidSerializer());
}
 
开发者ID:HoratiusTang,项目名称:EsperDist,代码行数:64,代码来源:Kryo.java

示例3: initialValue

import com.esotericsoftware.kryo.serializers.DefaultSerializers.TreeMapSerializer; //导入依赖的package包/类
@Override
protected Kryo initialValue() {
	// disallow nulls wherever possible
	Kryo kryo = new Kryo();
	kryo.setInstantiatorStrategy(new SerializingInstantiatorStrategy());

	FastUtilsKryoSerializers.addDefaultSerializers(kryo);

	// TODO: double check we don't need to handle cyclic object graphs
	kryo.setReferences(false);
	kryo.setRegistrationRequired(true);

	// prepare default serializers to disallow null keys and values
	CollectionSerializer collectionSerializer = new CollectionSerializer();
	collectionSerializer.setElementsCanBeNull(false);

	TreeMapSerializer treeMapSerializer = new TreeMapSerializer();
	treeMapSerializer.setKeysCanBeNull(false);
	treeMapSerializer.setValuesCanBeNull(false);

	MapSerializer mapSerializer = new MapSerializer();
	mapSerializer.setKeysCanBeNull(false);
	mapSerializer.setValuesCanBeNull(false);

	// register in approx order from inner loops to outer loops
	kryo.register(UUID.class);
	kryo.register(PartitionSlice.EdgeTuple.class);
	kryo.register(PartitionSlice.VertexTuple.class);
	kryo.register(PartitionSlice.SubgraphTuple.class);
	kryo.register(PartitionSlice.PropertyTuple.class, new PartitionSlice.PropertyTuple.PropertyTupleSerializer());
	kryo.register(PartitionSlice.RemoteVertexInfo.class);
	kryo.register(InstancesMetadata.class);
	kryo.register(InstancesMetadata.InstanceMetadata.class);
	kryo.register(InstancesMetadata.InstanceTuple.class);
	kryo.register(VersioningSlice.class);

	kryo.register(ArrayList.class, collectionSerializer);
	kryo.register(HashMap.class, mapSerializer);
	kryo.register(TreeMap.class, treeMapSerializer);
	kryo.register(TreeSet.class, collectionSerializer);
	kryo.register(Long2IntOpenHashMap.class);
	kryo.register(Long2ObjectOpenHashMap.class, new Long2ObjectOpenHashMapSerializer<>(null, null, false));
	kryo.register(Long2ObjectAVLTreeMap.class, new Long2ObjectAVLTreeMapSerializer<>(null, null, false));
	kryo.register(Long2ObjectMaps.UnmodifiableMap.class);
	kryo.register(Long2IntMaps.UnmodifiableMap.class);
	UnmodifiableCollectionsSerializer.registerSerializers(kryo);

	kryo.register(ISlice.class);
	kryo.register(PartitionMetadataSlice.class);
	kryo.register(PartitionSlice.class);
	kryo.register(PartitionInstancesSlice.class);

	return kryo;
}
 
开发者ID:dream-lab,项目名称:goffish_v2,代码行数:55,代码来源:KryoSliceSerializer.java

示例4: Kryo

import com.esotericsoftware.kryo.serializers.DefaultSerializers.TreeMapSerializer; //导入依赖的package包/类
/** @param referenceResolver May be null to disable references. */
public Kryo (ClassResolver classResolver, ReferenceResolver referenceResolver, StreamFactory streamFactory) {
	if (classResolver == null) throw new IllegalArgumentException("classResolver cannot be null.");

	this.classResolver = classResolver;
	classResolver.setKryo(this);

	this.streamFactory = streamFactory;
	streamFactory.setKryo(this);

	this.referenceResolver = referenceResolver;
	if (referenceResolver != null) {
		referenceResolver.setKryo(this);
		references = true;
	}

	addDefaultSerializer(byte[].class, ByteArraySerializer.class);
	addDefaultSerializer(char[].class, CharArraySerializer.class);
	addDefaultSerializer(short[].class, ShortArraySerializer.class);
	addDefaultSerializer(int[].class, IntArraySerializer.class);
	addDefaultSerializer(long[].class, LongArraySerializer.class);
	addDefaultSerializer(float[].class, FloatArraySerializer.class);
	addDefaultSerializer(double[].class, DoubleArraySerializer.class);
	addDefaultSerializer(boolean[].class, BooleanArraySerializer.class);
	addDefaultSerializer(String[].class, StringArraySerializer.class);
	addDefaultSerializer(Object[].class, ObjectArraySerializer.class);
	addDefaultSerializer(BigInteger.class, BigIntegerSerializer.class);
	addDefaultSerializer(BigDecimal.class, BigDecimalSerializer.class);
	addDefaultSerializer(Class.class, ClassSerializer.class);
	addDefaultSerializer(Date.class, DateSerializer.class);
	addDefaultSerializer(Enum.class, EnumSerializer.class);
	addDefaultSerializer(EnumSet.class, EnumSetSerializer.class);
	addDefaultSerializer(Currency.class, CurrencySerializer.class);
	addDefaultSerializer(StringBuffer.class, StringBufferSerializer.class);
	addDefaultSerializer(StringBuilder.class, StringBuilderSerializer.class);
	addDefaultSerializer(Collections.EMPTY_LIST.getClass(), CollectionsEmptyListSerializer.class);
	addDefaultSerializer(Collections.EMPTY_MAP.getClass(), CollectionsEmptyMapSerializer.class);
	addDefaultSerializer(Collections.EMPTY_SET.getClass(), CollectionsEmptySetSerializer.class);
	addDefaultSerializer(Collections.singletonList(null).getClass(), CollectionsSingletonListSerializer.class);
	addDefaultSerializer(Collections.singletonMap(null, null).getClass(), CollectionsSingletonMapSerializer.class);
	addDefaultSerializer(Collections.singleton(null).getClass(), CollectionsSingletonSetSerializer.class);
	addDefaultSerializer(Collection.class, CollectionSerializer.class);
	addDefaultSerializer(TreeMap.class, TreeMapSerializer.class);
	addDefaultSerializer(Map.class, MapSerializer.class);
	addDefaultSerializer(KryoSerializable.class, KryoSerializableSerializer.class);
	addDefaultSerializer(TimeZone.class, TimeZoneSerializer.class);
	addDefaultSerializer(Calendar.class, CalendarSerializer.class);
	lowPriorityDefaultSerializerCount = defaultSerializers.size();

	// Primitives and string. Primitive wrappers automatically use the same registration as primitives.
	register(int.class, new IntSerializer());
	register(String.class, new StringSerializer());
	register(float.class, new FloatSerializer());
	register(boolean.class, new BooleanSerializer());
	register(byte.class, new ByteSerializer());
	register(char.class, new CharSerializer());
	register(short.class, new ShortSerializer());
	register(long.class, new LongSerializer());
	register(double.class, new DoubleSerializer());
}
 
开发者ID:esialb,项目名称:kryo-mavenized,代码行数:61,代码来源:Kryo.java


注:本文中的com.esotericsoftware.kryo.serializers.DefaultSerializers.TreeMapSerializer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。