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


Java KryoReflectionFactorySupport类代码示例

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


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

示例1: createKryo

import de.javakaffee.kryoserializers.KryoReflectionFactorySupport; //导入依赖的package包/类
private Kryo createKryo() {
    Kryo result = new KryoReflectionFactorySupport() {
        
        @Override
        public Serializer<?> getDefaultSerializer(@SuppressWarnings("rawtypes") final Class clazz) {
            if (EnumMap.class.isAssignableFrom(clazz)) {
                return new EnumMapSerializer();
            }
            if (SubListSerializers.ArrayListSubListSerializer.canSerialize(clazz) || SubListSerializers.JavaUtilSubListSerializer.canSerialize(clazz)) {
                return SubListSerializers.createFor(clazz);
            }
            return super.getDefaultSerializer(clazz);
        }
    };
    result.register(Collections.singletonList("").getClass(), new ArraysAsListSerializer());
    UnmodifiableCollectionsSerializer.registerSerializers(result);
    return result;
}
 
开发者ID:terrymanu,项目名称:miracle-remote,代码行数:19,代码来源:PooledKryoFactory.java

示例2: initialValue

import de.javakaffee.kryoserializers.KryoReflectionFactorySupport; //导入依赖的package包/类
@Override
protected Kryo initialValue() {
  final Kryo kryo = new KryoReflectionFactorySupport() {
    
    @Override
    public Serializer<?> getDefaultSerializer(@SuppressWarnings("rawtypes") final Class clazz) {
      if (EnumSet.class.isAssignableFrom(clazz)) {
        return new EnumSetSerializer();
      }
      if (EnumMap.class.isAssignableFrom(clazz)) {
        return new EnumMapSerializer();
      }
      final Serializer<?> serializer = super.getDefaultSerializer(clazz);
      if (serializer instanceof FieldSerializer) {
        ((FieldSerializer<?>) serializer).setCopyTransient(false);
      }
      return serializer;
    }
    
  };
  return kryo;
}
 
开发者ID:SimiaCryptus,项目名称:MindsEye,代码行数:23,代码来源:KryoUtil.java

示例3: createKryo

import de.javakaffee.kryoserializers.KryoReflectionFactorySupport; //导入依赖的package包/类
private Kryo createKryo() {
	Kryo kryo = new KryoReflectionFactorySupport() {
		
		@Override
		public Serializer<?> getDefaultSerializer(@SuppressWarnings("rawtypes") final Class clazz) {
			if (EnumMap.class.isAssignableFrom(clazz)) {
				return new EnumMapSerializer();
			}
			if (SubListSerializers.ArrayListSubListSerializer.canSerialize(clazz) || SubListSerializers.JavaUtilSubListSerializer.canSerialize(clazz)) {
				return SubListSerializers.createFor(clazz);
			}
			return super.getDefaultSerializer(clazz);
		}
	};
	kryo.register(Arrays.asList("").getClass(), new ArraysAsListSerializer());
	UnmodifiableCollectionsSerializer.registerSerializers(kryo);
	return kryo;
}
 
开发者ID:terrymanu,项目名称:miracle-framework,代码行数:19,代码来源:PooledKryoFactory.java

示例4: deserializeAlgoMetric

import de.javakaffee.kryoserializers.KryoReflectionFactorySupport; //导入依赖的package包/类
public static Metric deserializeAlgoMetric(byte [] data) {
  ByteArrayInputStream bais = new ByteArrayInputStream(data);
  Input input = new Input(bais);
  KryoReflectionFactorySupport kryoRef = getKryoRef();
  return ((Metric)kryoRef.readClassAndObject(input));
}
 
开发者ID:Tencent,项目名称:angel,代码行数:7,代码来源:KryoUtils.java

示例5: initialValue

import de.javakaffee.kryoserializers.KryoReflectionFactorySupport; //导入依赖的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

示例6: createKryo

import de.javakaffee.kryoserializers.KryoReflectionFactorySupport; //导入依赖的package包/类
/**
 * Override this method to change serialization rule.
 *
 * @return Kryo serializer instance.
 */
protected Kryo createKryo() {
    Kryo kryo = new KryoReflectionFactorySupport();
    kryo.setDefaultSerializer(CompatibleFieldSerializer.class);
    return kryo;
}
 
开发者ID:kwon37xi,项目名称:hibernate4-memcached,代码行数:11,代码来源:KryoTranscoder.java


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