org.springframework.data.gemfire.serialization
Class EnumSerializer

java.lang.Object
  extended by com.gemstone.gemfire.DataSerializer
      extended by org.springframework.data.gemfire.serialization.EnumSerializer
All Implemented Interfaces:
Serializable

public class EnumSerializer
extends DataSerializer
implements Serializable

Generic Serializer for JDK Enums. The class needs to be registered only once - custom enums will be then understood by the converter by calling addEnum(Class).

Author:
Costin Leau
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.gemstone.gemfire.DataSerializer
DEBUG, DISALLOW_JAVA_SERIALIZATION, DUMP_SERIALIZED, TRACE_SERIALIZABLE
 
Constructor Summary
EnumSerializer()
           
 
Method Summary
 void addEnum(Class enumClass)
           
 Object fromData(DataInput in)
           
 int getId()
           
 Class<?>[] getSupportedClasses()
           
 void setId(int id)
          Sets the id for this serializer.
 boolean toData(Object o, DataOutput out)
           
 
Methods inherited from class com.gemstone.gemfire.DataSerializer
equals, getContext, getEventId, hashCode, readArrayList, readArrayOfByteArrays, readBoolean, readBooleanArray, readByte, readByteArray, readCharacter, readCharArray, readClass, readDate, readDouble, readDoubleArray, readEnum, readFile, readFloat, readFloatArray, readHashMap, readHashSet, readHashtable, readIdentityHashMap, readInetAddress, readIntArray, readInteger, readLinkedHashSet, readLinkedList, readLong, readLongArray, readObject, readObjectArray, readPrimitiveBoolean, readPrimitiveByte, readPrimitiveChar, readPrimitiveDouble, readPrimitiveFloat, readPrimitiveInt, readPrimitiveLong, readPrimitiveShort, readProperties, readRegion, readShort, readShortArray, readStack, readString, readStringArray, readTreeMap, readTreeSet, readUnsignedByte, readUnsignedShort, readVector, register, register, setContext, setEventId, writeArrayList, writeArrayOfByteArrays, writeBoolean, writeBooleanArray, writeByte, writeByteArray, writeByteArray, writeCharacter, writeCharArray, writeClass, writeDate, writeDouble, writeDoubleArray, writeEnum, writeFile, writeFloat, writeFloatArray, writeHashMap, writeHashSet, writeHashtable, writeIdentityHashMap, writeInetAddress, writeIntArray, writeInteger, writeLinkedHashSet, writeLinkedList, writeLong, writeLongArray, writeObject, writeObject, writeObjectArray, writeObjectAsByteArray, writePrimitiveBoolean, writePrimitiveByte, writePrimitiveChar, writePrimitiveDouble, writePrimitiveFloat, writePrimitiveInt, writePrimitiveLong, writePrimitiveShort, writeProperties, writeRegion, writeShort, writeShortArray, writeStack, writeString, writeStringArray, writeTreeMap, writeTreeSet, writeUnsignedByte, writeUnsignedShort, writeVector
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnumSerializer

public EnumSerializer()
Method Detail

toData

public boolean toData(Object o,
                      DataOutput out)
               throws IOException
Specified by:
toData in class DataSerializer
Throws:
IOException

fromData

public Object fromData(DataInput in)
                throws IOException,
                       ClassNotFoundException
Specified by:
fromData in class DataSerializer
Throws:
IOException
ClassNotFoundException

addEnum

public void addEnum(Class enumClass)

getSupportedClasses

public Class<?>[] getSupportedClasses()
Specified by:
getSupportedClasses in class DataSerializer

getId

public int getId()
Specified by:
getId in class DataSerializer

setId

public void setId(int id)
Sets the id for this serializer. Default is 1024;

Parameters:
id - the id to set


Copyright © 2010 SpringSource, a division of VMware. All Rights Reserved.