de.javakaffee.web.msm.serializer.kryo
Class ComponentSerializerFactory

java.lang.Object
  extended by de.javakaffee.web.msm.serializer.kryo.ComponentSerializerFactory
All Implemented Interfaces:
SerializerFactory

public class ComponentSerializerFactory
extends Object
implements SerializerFactory

A KryoCustomization that creates a ReferenceFieldSerializerReflectionFactorySupport as serializer for subclasses of Component. This is required, as the Component constructor invokes Application.get() to tell the application to org.apache.wicket.Application#notifyComponentInstantiationListeners(). This will lead to NullpointerExceptions if the application is not yet bound to the current thread because the session is e.g. accessed from within a servlet filter. If the component is created via the constructor for serialization, this problem does not occur.

Author:
Martin Grotzke

Constructor Summary
ComponentSerializerFactory(com.esotericsoftware.kryo.Kryo kryo)
           
 
Method Summary
 com.esotericsoftware.kryo.Serializer newSerializer(Class<?> type)
          Returns a serializer for the specified type or null if the type is not supported by this factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentSerializerFactory

public ComponentSerializerFactory(com.esotericsoftware.kryo.Kryo kryo)
Method Detail

newSerializer

public com.esotericsoftware.kryo.Serializer newSerializer(Class<?> type)
Description copied from interface: SerializerFactory
Returns a serializer for the specified type or null if the type is not supported by this factory.

Specified by:
newSerializer in interface SerializerFactory
Parameters:
type - the type a serializer shall be created for.
Returns:
a Serializer implementation or null.


Copyright © 2009-2012. All Rights Reserved.