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


Java EnumMapSerializer类代码示例

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


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

示例1: createKryo

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

import de.javakaffee.kryoserializers.EnumMapSerializer; //导入依赖的package包/类
public static Kryo getKryoInstance() {

    Track.pushInfo("CreateKryoInstance");
    try {
      Kryo lKryo = new Kryo();

      //Note: Doco says all strategies are thread safe: http://objenesis.org/tutorial.html
      //Note: This introduces a dependency on the JVMs supported by Objenesis: http://code.google.com/p/objenesis/wiki/ListOfCurrentlySupportedVMs
      lKryo.setInstantiatorStrategy(INSTANTIATOR_STRATEGY);

      //Use the kryo-serializers library to handle unmodifiable collections (not supported by kryo out of the box).
      UnmodifiableCollectionsSerializer.registerSerializers(lKryo);
      lKryo.register(EnumMap.class, new EnumMapSerializer());

      //Register our custom DOM serialiser
      lKryo.register(DOM.class, new DOMSerializer());

      return lKryo;
    }
    finally {
      Track.pop("CreateKryoInstance");
    }
  }
 
开发者ID:Fivium,项目名称:FOXopen,代码行数:24,代码来源:KryoManager.java

示例3: initialValue

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

示例4: createKryo

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

示例5: initialize

import de.javakaffee.kryoserializers.EnumMapSerializer; //导入依赖的package包/类
/**
 * Initialize and register classes with kryo.
 */
public void initialize() {
    // Register types we know about and do not require external configuration
    kryo.register(ArrayList.class);
    kryo.register(BasicCredentialMetaData.class);
    kryo.register(Class.class, new DefaultSerializers.ClassSerializer());
    kryo.register(Date.class, new DefaultSerializers.DateSerializer());
    kryo.register(HardTimeoutExpirationPolicy.class);
    kryo.register(HashMap.class);
    kryo.register(LinkedHashMap.class);
    kryo.register(HashSet.class);
    kryo.register(DefaultHandlerResult.class);
    kryo.register(ImmutableAuthentication.class);
    kryo.register(MultiTimeUseOrTimeoutExpirationPolicy.class);
    kryo.register(NeverExpiresExpirationPolicy.class);
    kryo.register(RememberMeDelegatingExpirationPolicy.class);
    kryo.register(ServiceTicketImpl.class);
    kryo.register(SimpleWebApplicationServiceImpl.class, new SimpleWebApplicationServiceSerializer());
    kryo.register(ThrottledUseAndTimeoutExpirationPolicy.class);
    kryo.register(TicketGrantingTicketExpirationPolicy.class);
    kryo.register(TicketGrantingTicketImpl.class);
    kryo.register(TimeoutExpirationPolicy.class);
    kryo.register(UsernamePasswordCredential.class);
    kryo.register(SimplePrincipal.class);
    kryo.register(URL.class, new URLSerializer());
    kryo.register(URI.class, new URISerializer());
    kryo.register(Pattern.class, new RegexSerializer());
    kryo.register(UUID.class, new UUIDSerializer());
    kryo.register(EnumMap.class, new EnumMapSerializer());
    kryo.register(EnumSet.class, new EnumSetSerializer());

    // we add these ones for tests only
    kryo.register(RegisteredServiceImpl.class, new RegisteredServiceSerializer());
    kryo.register(RegexRegisteredService.class, new RegisteredServiceSerializer());

    // new serializers to manage Joda dates and immutable collections
    kryo.register(DateTime.class, new JodaDateTimeSerializer());
    kryo.register(CasDelegatingLogger.class, new DefaultSerializers.VoidSerializer());

    // from the kryo-serializers library (https://github.com/magro/kryo-serializers)
    UnmodifiableCollectionsSerializer.registerSerializers(kryo);
    ImmutableListSerializer.registerSerializers(kryo);
    ImmutableSetSerializer.registerSerializers(kryo);
    ImmutableMapSerializer.registerSerializers(kryo);
    ImmutableMultimapSerializer.registerSerializers(kryo);
    
    kryo.register(Collections.EMPTY_LIST.getClass(), new CollectionsEmptyListSerializer());
    kryo.register(Collections.EMPTY_MAP.getClass(), new CollectionsEmptyMapSerializer());
    kryo.register(Collections.EMPTY_SET.getClass(), new CollectionsEmptySetSerializer());

    // Register other types
    if (serializerMap != null) {
        for (final Map.Entry<Class<?>, Serializer> clazz : serializerMap.entrySet()) {
            kryo.register(clazz.getKey(), clazz.getValue());
        }
    }

    // don't reinit the registered classes after every write or read
    kryo.setAutoReset(false);
    // don't replace objects by references
    kryo.setReferences(false);
    // Catchall for any classes not explicitly registered
    kryo.setRegistrationRequired(false);
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:67,代码来源:KryoTranscoder.java

示例6: initialize

import de.javakaffee.kryoserializers.EnumMapSerializer; //导入依赖的package包/类
/**
 * Initialize and register classes with kryo.
 */
@PostConstruct
public void initialize() {
    // Register types we know about and do not require external configuration
    this.kryo.register(EncodedTicket.class);
    this.kryo.register(ArrayList.class);
    this.kryo.register(BasicCredentialMetaData.class);
    this.kryo.register(Class.class, new DefaultSerializers.ClassSerializer());
    this.kryo.register(ZonedDateTime.class, new ZonedDateTimeTranscoder());
    this.kryo.register(HardTimeoutExpirationPolicy.class);
    this.kryo.register(HashMap.class);
    this.kryo.register(LinkedHashMap.class);
    this.kryo.register(HashSet.class);
    this.kryo.register(DefaultHandlerResult.class);
    this.kryo.register(DefaultAuthentication.class);
    this.kryo.register(MultiTimeUseOrTimeoutExpirationPolicy.class);
    this.kryo.register(NeverExpiresExpirationPolicy.class);
    this.kryo.register(RememberMeDelegatingExpirationPolicy.class);
    this.kryo.register(ServiceTicketImpl.class);
    this.kryo.register(SimpleWebApplicationServiceImpl.class, new SimpleWebApplicationServiceSerializer());
    this.kryo.register(ThrottledUseAndTimeoutExpirationPolicy.class);
    this.kryo.register(TicketGrantingTicketExpirationPolicy.class);
    this.kryo.register(TicketGrantingTicketImpl.class);
    this.kryo.register(TimeoutExpirationPolicy.class);
    this.kryo.register(UsernamePasswordCredential.class);
    this.kryo.register(SimplePrincipal.class);
    this.kryo.register(URL.class, new URLSerializer());
    this.kryo.register(URI.class, new URISerializer());
    this.kryo.register(Pattern.class, new RegexSerializer());
    this.kryo.register(UUID.class, new UUIDSerializer());
    this.kryo.register(EnumMap.class, new EnumMapSerializer());
    this.kryo.register(EnumSet.class, new EnumSetSerializer());

    // we add these ones for tests only
    this.kryo.register(RegexRegisteredService.class, new RegisteredServiceSerializer());
    
    // from the kryo-serializers library (https://github.com/magro/kryo-serializers)
    UnmodifiableCollectionsSerializer.registerSerializers(this.kryo);
    ImmutableListSerializer.registerSerializers(this.kryo);
    ImmutableSetSerializer.registerSerializers(this.kryo);
    ImmutableMapSerializer.registerSerializers(this.kryo);
    ImmutableMultimapSerializer.registerSerializers(this.kryo);

    this.kryo.register(Collections.EMPTY_LIST.getClass(), new CollectionsEmptyListSerializer());
    this.kryo.register(Collections.EMPTY_MAP.getClass(), new CollectionsEmptyMapSerializer());
    this.kryo.register(Collections.EMPTY_SET.getClass(), new CollectionsEmptySetSerializer());

    // Register other types
    if (this.serializerMap != null) {
        this.serializerMap.forEach(this.kryo::register);
    }

    // don't reinit the registered classes after every write or read
    this.kryo.setAutoReset(false);
    // don't replace objects by references
    this.kryo.setReferences(false);
    // Catchall for any classes not explicitly registered
    this.kryo.setRegistrationRequired(false);
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:62,代码来源:KryoTranscoder.java

示例7: initialValue

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


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