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


Java JodaDateTimeSerializer类代码示例

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


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

示例1: testCustomSerializer

import de.javakaffee.kryoserializers.jodatime.JodaDateTimeSerializer; //导入依赖的package包/类
@Test
public void testCustomSerializer() {
    Paper.addSerializer(DateTime.class, new JodaDateTimeSerializer());
    DateTime now = DateTime.now(DateTimeZone.UTC);

    Paper.book().write("joda-datetime", now);
    assertEquals(now, Paper.book().read("joda-datetime"));
}
 
开发者ID:pilgr,项目名称:Paper,代码行数:9,代码来源:PaperTest.java

示例2: initialize

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

示例3: initialize

import de.javakaffee.kryoserializers.jodatime.JodaDateTimeSerializer; //导入依赖的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(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(URL.class, new URLSerializer());

    // 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);

    // 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,代码行数:50,代码来源:KryoTranscoder.java

示例4: initialize

import de.javakaffee.kryoserializers.jodatime.JodaDateTimeSerializer; //导入依赖的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(HandlerResult.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(URL.class, new URLSerializer());

    // 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());
    // from the kryo-serializers library (https://github.com/magro/kryo-serializers)
    UnmodifiableCollectionsSerializer.registerSerializers(kryo);

    // 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:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:48,代码来源:KryoTranscoder.java

示例5: copy

import de.javakaffee.kryoserializers.jodatime.JodaDateTimeSerializer; //导入依赖的package包/类
public static <T> T copy(T entity) {
	Kryo kryo = new Kryo();
	kryo.register( DateTime.class, new JodaDateTimeSerializer() );
	return kryo.copy(entity);
}
 
开发者ID:bullhorn,项目名称:sdk-rest,代码行数:6,代码来源:KryoObjectCopyHelper.java

示例6: copyShallow

import de.javakaffee.kryoserializers.jodatime.JodaDateTimeSerializer; //导入依赖的package包/类
public static <T> T copyShallow(T entity) {
	Kryo kryo = new Kryo();
	kryo.register( DateTime.class, new JodaDateTimeSerializer() );
	return kryo.copyShallow(entity);
}
 
开发者ID:bullhorn,项目名称:sdk-rest,代码行数:6,代码来源:KryoObjectCopyHelper.java

示例7: getInstance

import de.javakaffee.kryoserializers.jodatime.JodaDateTimeSerializer; //导入依赖的package包/类
public static Kryo getInstance()  {
	Kryo kryo = new Kryo();

	// 
	kryo.setRegistrationRequired(false);
	kryo.setReferences(false);
	kryo.setInstantiatorStrategy(new StdInstantiatorStrategy());

	// some common classes and their corresponding serializer
	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(EnumMap.class, new EnumMapSerializer());
	kryo.register(BitSet.class, new BitSetSerializer());
	kryo.register(Pattern.class, new RegexSerializer());
	
	UnmodifiableCollectionsSerializer.registerSerializers(kryo);
	SynchronizedCollectionsSerializer.registerSerializers(kryo);
	// Kryo can't not serialize IndifferentAccessMap in storm, use the default java serializer


	
	// joda datetime
	kryo.register(DateTime.class, new JodaDateTimeSerializer());

	kryo.register(ArrayList.class);
	kryo.register(LinkedList.class);
	kryo.register(HashMap.class);
	kryo.register(HashSet.class);

	kryo.register(OhmageUser.class);
	kryo.register(OhmageServer.class);

	kryo.register(TimeWindow.class);
	kryo.register(PendingBuffer.class);

	/* base stream record models */
	kryo.register(GeoLocation.class);
	kryo.register(MobilityState.class);
	kryo.register(StreamMetadata.class);
	kryo.register(StreamRecord.class);
	
	/* stream data models */
	kryo.register(MobilityData.class);
	kryo.register(GeoDiameterData.class);
	kryo.register(ActivityEpisode.class);
	kryo.register(ActivitySummaryData.class);
	kryo.register(TimeWindowData.class);
	kryo.register(MobilityData.class);
	kryo.register(RectifiedMobilityData.class);
	kryo.register(MovesSegment.class);
	return kryo;
}
 
开发者ID:ohmage,项目名称:lifestreams,代码行数:67,代码来源:KryoSerializer.java

示例8: copy

import de.javakaffee.kryoserializers.jodatime.JodaDateTimeSerializer; //导入依赖的package包/类
public static <T> T copy(T entity) {
	Kryo kryo = new Kryo();

	kryo.register( DateTime.class, new JodaDateTimeSerializer() );

	return kryo.copy(entity);
}
 
开发者ID:bullhorn,项目名称:starter-kit-spring-maven,代码行数:8,代码来源:KryoObjectCopyHelper.java

示例9: copyShallow

import de.javakaffee.kryoserializers.jodatime.JodaDateTimeSerializer; //导入依赖的package包/类
public static <T> T copyShallow(T entity) {
	Kryo kryo = new Kryo();

	kryo.register( DateTime.class, new JodaDateTimeSerializer() );

	return kryo.copyShallow(entity);
}
 
开发者ID:bullhorn,项目名称:starter-kit-spring-maven,代码行数:8,代码来源:KryoObjectCopyHelper.java


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