Java Code Examples for com.esotericsoftware.kryo.factories.ReflectionSerializerFactory

The following examples show how to use com.esotericsoftware.kryo.factories.ReflectionSerializerFactory. These examples are extracted from open source projects. 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 Project: Flink-CEPplus   Source File: KryoRegistration.java    License: 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 Project: flink   Source File: KryoRegistration.java    License: 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 Project: subzero   Source File: PropertyUserSerializer.java    License: 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 Project: flink   Source File: KryoRegistration.java    License: 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);
	}
}