com.esotericsoftware.kryo.factories.ReflectionSerializerFactory Java Examples

The following examples show how to use com.esotericsoftware.kryo.factories.ReflectionSerializerFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KryoRegistration.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public Serializer<?> getSerializer(Kryo kryo) {
	switch (serializerDefinitionType) {
		case UNSPECIFIED:
			return null;
		case CLASS:
			return ReflectionSerializerFactory.makeSerializer(kryo, serializerClass, registeredClass);
		case INSTANCE:
			return serializableSerializerInstance.getSerializer();
		default:
			// this should not happen; adding as a guard for the future
			throw new IllegalStateException(
					"Unrecognized Kryo registration serializer definition type: " + serializerDefinitionType);
	}
}
 
Example #2
Source File: KryoRegistration.java    From flink with Apache License 2.0 5 votes vote down vote up
public Serializer<?> getSerializer(Kryo kryo) {
	switch (serializerDefinitionType) {
		case UNSPECIFIED:
			return null;
		case CLASS:
			return ReflectionSerializerFactory.makeSerializer(kryo, serializerClass, registeredClass);
		case INSTANCE:
			return serializableSerializerInstance.getSerializer();
		default:
			// this should not happen; adding as a guard for the future
			throw new IllegalStateException(
					"Unrecognized Kryo registration serializer definition type: " + serializerDefinitionType);
	}
}
 
Example #3
Source File: PropertyUserSerializer.java    From subzero with Apache License 2.0 5 votes vote down vote up
private void registerDefaultSerializer(Kryo kryo) {
    if (defaultSerializerClass != null || !serializerConfigurers.isEmpty()) {
        Class<? extends Serializer> serializerClass = defaultSerializerClass == null
                ? FieldSerializer.class
                : defaultSerializerClass;

        SerializerFactory serializerFactory = new ReflectionSerializerFactory(serializerClass);
        if (!serializerConfigurers.isEmpty()) {
            SerializerConfigurer configurer = serializerConfigurers.get(0);
            serializerFactory = new PostProcessingSerializerFactory(serializerFactory, configurer);
        }
        kryo.setDefaultSerializer(serializerFactory);
    }
}
 
Example #4
Source File: KryoRegistration.java    From flink with Apache License 2.0 5 votes vote down vote up
public Serializer<?> getSerializer(Kryo kryo) {
	switch (serializerDefinitionType) {
		case UNSPECIFIED:
			return null;
		case CLASS:
			return ReflectionSerializerFactory.makeSerializer(kryo, serializerClass, registeredClass);
		case INSTANCE:
			return serializableSerializerInstance.getSerializer();
		default:
			// this should not happen; adding as a guard for the future
			throw new IllegalStateException(
					"Unrecognized Kryo registration serializer definition type: " + serializerDefinitionType);
	}
}