• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java JdkProxySerializer类的典型用法和代码示例

java 1次浏览

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

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

示例1: createKryoInstance

点赞 3

import de.javakaffee.kryoserializers.JdkProxySerializer; //导入依赖的package包/类
public static Kryo createKryoInstance() {
	Kryo kryo = new Kryo();
	
	// add custom serialisers to work with joda time (the kryo version that we get when including spark as a dependency cannot handle joda time by default)
	// see https://github.com/magro/kryo-serializers
	
	kryo.register( Arrays.asList( "" ).getClass(), new ArraysAsListSerializer() );
	kryo.register( Collections.EMPTY_LIST.getClass(), new CollectionsEmptyListSerializer() );
	kryo.register( Collections.EMPTY_MAP.getClass(), new CollectionsEmptyMapSerializer() );
	kryo.register( Collections.EMPTY_SET.getClass(), new CollectionsEmptySetSerializer() );
	kryo.register( Collections.singletonList( "" ).getClass(), new CollectionsSingletonListSerializer() );
	kryo.register( Collections.singleton( "" ).getClass(), new CollectionsSingletonSetSerializer() );
	kryo.register( Collections.singletonMap( "", "" ).getClass(), new CollectionsSingletonMapSerializer() );
	kryo.register( GregorianCalendar.class, new GregorianCalendarSerializer() );
	kryo.register( InvocationHandler.class, new JdkProxySerializer() );
	UnmodifiableCollectionsSerializer.registerSerializers( kryo );
	SynchronizedCollectionsSerializer.registerSerializers( kryo );

	// custom serializers for non-jdk libs
	
	return kryo;
}
 

开发者ID:olehmberg,
项目名称:T2KMatch,
代码行数:23,
代码来源:KryoFactory.java

示例2: tryRegister

点赞 2

import de.javakaffee.kryoserializers.JdkProxySerializer; //导入依赖的package包/类
public static void tryRegister(Kryo kryo) {
    kryo.register(ARRAYS_AS_LIST_CLASS, new ArraysAsListSerializer());
    kryo.register(GregorianCalendar.class, new GregorianCalendarSerializer());
    kryo.register(InvocationHandler.class, new JdkProxySerializer());
    kryo.register(GregorianCalendar.class, new GregorianCalendarSerializer());
    kryo.register(InvocationHandler.class, new JdkProxySerializer());

    UnmodifiableCollectionsSerializer.registerSerializers(kryo);

    SynchronizedCollectionsSerializer.registerSerializers(kryo);
}
 

开发者ID:hekate-io,
项目名称:hekate,
代码行数:12,
代码来源:JavaKaffeeSerializersRegistrar.java

示例3: initialValue

点赞 2

import de.javakaffee.kryoserializers.JdkProxySerializer; //导入依赖的package包/类
@Override
    protected Kryo initialValue() {
      Kryo ret = new Kryo();
      ret.setReferences(true);
      ret.setInstantiatorStrategy(new DefaultInstantiatorStrategy(new StdInstantiatorStrategy()));

      ret.register(Arrays.asList("").getClass(), new ArraysAsListSerializer());
      ret.register(Collections.EMPTY_LIST.getClass(), new CollectionsEmptyListSerializer());
      ret.register(Collections.EMPTY_MAP.getClass(), new CollectionsEmptyMapSerializer());
      ret.register(Collections.EMPTY_SET.getClass(), new CollectionsEmptySetSerializer());
      ret.register(Collections.singletonList("").getClass(), new CollectionsSingletonListSerializer());
      ret.register(Collections.singleton("").getClass(), new CollectionsSingletonSetSerializer());
      ret.register(Collections.singletonMap("", "").getClass(), new CollectionsSingletonMapSerializer());
      ret.register(GregorianCalendar.class, new GregorianCalendarSerializer());
      ret.register(InvocationHandler.class, new JdkProxySerializer());
      UnmodifiableCollectionsSerializer.registerSerializers(ret);
      SynchronizedCollectionsSerializer.registerSerializers(ret);

// custom serializers for non-jdk libs

// register CGLibProxySerializer, works in combination with the appropriate action in handleUnregisteredClass (see below)
      ret.register(CGLibProxySerializer.CGLibProxyMarker.class, new CGLibProxySerializer());
// joda DateTime, LocalDate and LocalDateTime
      ret.register(LocalDate.class, new JodaLocalDateSerializer());
      ret.register(LocalDateTime.class, new JodaLocalDateTimeSerializer());
// guava ImmutableList, ImmutableSet, ImmutableMap, ImmutableMultimap, UnmodifiableNavigableSet
      ImmutableListSerializer.registerSerializers(ret);
      ImmutableSetSerializer.registerSerializers(ret);
      ImmutableMapSerializer.registerSerializers(ret);
      ImmutableMultimapSerializer.registerSerializers(ret);
      return ret;
    }
 

开发者ID:apache,
项目名称:metron,
代码行数:33,
代码来源:SerDeUtils.java

示例4: initialValue

点赞 2

import de.javakaffee.kryoserializers.JdkProxySerializer; //导入依赖的package包/类
protected Kryo initialValue() {
    Kryo _kryo = new KryoReflectionFactorySupport() {

        @Override
        @SuppressWarnings( { "rawtypes", "unchecked" } )
        public Serializer<?> getDefaultSerializer( final Class type ) {
            if ( EnumSet.class.isAssignableFrom( type ) ) {
                return new EnumSetSerializer();
            }
            if ( EnumMap.class.isAssignableFrom( type ) ) {
                return new EnumMapSerializer();
            }
            if ( Collection.class.isAssignableFrom( type ) ) {
                return new CopyForIterateCollectionSerializer();
            }
            if ( Map.class.isAssignableFrom( type ) ) {
                return new CopyForIterateMapSerializer();
            }
            if ( Date.class.isAssignableFrom( type ) ) {
                return new DateSerializer( type );
            }
            return super.getDefaultSerializer( type );
        }
    };
    _kryo.setRegistrationRequired(false);
    _kryo.register( Arrays.asList( "" ).getClass(), new ArraysAsListSerializer() );
    _kryo.register( Collections.EMPTY_LIST.getClass(), new CollectionsEmptyListSerializer() );
    _kryo.register( Collections.EMPTY_MAP.getClass(), new CollectionsEmptyMapSerializer() );
    _kryo.register( Collections.EMPTY_SET.getClass(), new CollectionsEmptySetSerializer() );
    _kryo.register( Collections.singletonList( "" ).getClass(), new CollectionsSingletonListSerializer() );
    _kryo.register( Collections.singleton( "" ).getClass(), new CollectionsSingletonSetSerializer() );
    _kryo.register( Collections.singletonMap( "", "" ).getClass(), new CollectionsSingletonMapSerializer() );
    _kryo.register( BigDecimal.class, new BigDecimalSerializer() );
    _kryo.register( BigInteger.class, new BigIntegerSerializer() );
    //      _kryo.register( Pattern.class, new RegexSerializer() );
    //      _kryo.register( BitSet.class, new BitSetSerializer() );
    //      _kryo.register( URI.class, new URISerializer() );
    //      _kryo.register( UUID.class, new UUIDSerializer() );
    _kryo.register( GregorianCalendar.class, new GregorianCalendarSerializer() );
    _kryo.register( InvocationHandler.class, new JdkProxySerializer() );
    UnmodifiableCollectionsSerializer.registerSerializers( _kryo );
    SynchronizedCollectionsSerializer.registerSerializers( _kryo );
    //      DeflateSerializer d;      
    //      _kryo..setDefaultSerializer(CompatibleFieldSerializer.class);
    return _kryo;
}
 

开发者ID:dawnbreaks,
项目名称:NettyRPC,
代码行数:47,
代码来源:KryoSerializer.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)