use of de.javakaffee.kryoserializers.RegexSerializer in project cas by apereo.
the class KryoTranscoder method initialize.
/**
* 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);
}
use of de.javakaffee.kryoserializers.RegexSerializer in project dubbo by alibaba.
the class AbstractKryoFactory method create.
public Kryo create() {
if (!kryoCreated) {
kryoCreated = true;
}
Kryo kryo = new CompatibleKryo();
// TODO
// kryo.setReferences(false);
kryo.setRegistrationRequired(registrationRequired);
kryo.register(Arrays.asList("").getClass(), new ArraysAsListSerializer());
kryo.register(GregorianCalendar.class, new GregorianCalendarSerializer());
kryo.register(InvocationHandler.class, new JdkProxySerializer());
kryo.register(BigDecimal.class, new DefaultSerializers.BigDecimalSerializer());
kryo.register(BigInteger.class, new DefaultSerializers.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());
UnmodifiableCollectionsSerializer.registerSerializers(kryo);
SynchronizedCollectionsSerializer.registerSerializers(kryo);
// now just added some very common classes
// TODO optimization
kryo.register(HashMap.class);
kryo.register(ArrayList.class);
kryo.register(LinkedList.class);
kryo.register(HashSet.class);
kryo.register(TreeSet.class);
kryo.register(Hashtable.class);
kryo.register(Date.class);
kryo.register(Calendar.class);
kryo.register(ConcurrentHashMap.class);
kryo.register(SimpleDateFormat.class);
kryo.register(GregorianCalendar.class);
kryo.register(Vector.class);
kryo.register(BitSet.class);
kryo.register(StringBuffer.class);
kryo.register(StringBuilder.class);
kryo.register(Object.class);
kryo.register(Object[].class);
kryo.register(String[].class);
kryo.register(byte[].class);
kryo.register(char[].class);
kryo.register(int[].class);
kryo.register(float[].class);
kryo.register(double[].class);
for (Class clazz : registrations) {
kryo.register(clazz);
}
for (Class clazz : SerializableClassRegistry.getRegisteredClasses()) {
kryo.register(clazz);
}
return kryo;
}
use of de.javakaffee.kryoserializers.RegexSerializer in project cas by apereo.
the class CloseableKryoFactory method registerNativeJdkComponentsWithKryo.
private void registerNativeJdkComponentsWithKryo(final Kryo kryo) {
kryo.register(Class.class, new DefaultSerializers.ClassSerializer());
kryo.register(ZonedDateTime.class, new ZonedDateTimeSerializer());
kryo.register(ArrayList.class);
kryo.register(HashMap.class);
kryo.register(LinkedHashMap.class);
kryo.register(byte[].class);
kryo.register(LinkedHashSet.class);
kryo.register(ByteBuffer.class);
kryo.register(HashSet.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());
}
Aggregations