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


Java CurrencySerializer類代碼示例

本文整理匯總了Java中com.esotericsoftware.kryo.serializers.DefaultSerializers.CurrencySerializer的典型用法代碼示例。如果您正苦於以下問題:Java CurrencySerializer類的具體用法?Java CurrencySerializer怎麽用?Java CurrencySerializer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CurrencySerializer類屬於com.esotericsoftware.kryo.serializers.DefaultSerializers包,在下文中一共展示了CurrencySerializer類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: Kryo

import com.esotericsoftware.kryo.serializers.DefaultSerializers.CurrencySerializer; //導入依賴的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.CurrencySerializer; //導入依賴的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: Kryo

import com.esotericsoftware.kryo.serializers.DefaultSerializers.CurrencySerializer; //導入依賴的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.CurrencySerializer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。