Class EnumSerializer

java.lang.Object
org.apache.geode.DataSerializer
org.springframework.data.gemfire.serialization.EnumSerializer
All Implemented Interfaces:
Serializable

public class EnumSerializer extends org.apache.geode.DataSerializer implements Serializable
Generic serializer for all Java Enums. The class needs to be registered only once. Custom enums will then be understood by the converter by calling addEnum(Class).
See Also:
  • Field Summary

    Fields inherited from class org.apache.geode.DataSerializer

    DISALLOW_JAVA_SERIALIZATION, DOUBLE, INT, LONG, PRESENT, TRACE_SERIALIZABLE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    addEnum(Class<?> enumType)
     
     
    int
     
    Class<?>[]
     
    void
    setId(int id)
    Sets the id of this serializer.
    boolean
     

    Methods inherited from class org.apache.geode.DataSerializer

    equals, getContext, getEventId, hashCode, readArrayList, readArrayOfByteArrays, readBoolean, readBooleanArray, readByte, readByteArray, readCharacter, readCharArray, readClass, readConcurrentHashMap, readDate, readDouble, readDoubleArray, readEnum, readFile, readFloat, readFloatArray, readHashMap, readHashSet, readHashtable, readIdentityHashMap, readInetAddress, readIntArray, readInteger, readLinkedHashMap, readLinkedHashSet, readLinkedList, readLong, readLongArray, readNonPrimitiveClassName, readObject, readObjectArray, readOptional, readOptionalDouble, readOptionalInt, readOptionalLong, readOptionalPrimitive, readPrimitiveBoolean, readPrimitiveByte, readPrimitiveChar, readPrimitiveDouble, readPrimitiveFloat, readPrimitiveInt, readPrimitiveLong, readPrimitiveShort, readProperties, readRegion, readShort, readShortArray, readStack, readString, readStringArray, readTreeMap, readTreeSet, readUnsignedByte, readUnsignedShort, readVector, register, setContext, setEventId, writeArrayList, writeArrayOfByteArrays, writeBoolean, writeBooleanArray, writeByte, writeByteArray, writeByteArray, writeCharacter, writeCharArray, writeClass, writeConcurrentHashMap, writeDate, writeDouble, writeDoubleArray, writeEnum, writeFile, writeFloat, writeFloatArray, writeHashMap, writeHashSet, writeHashtable, writeIdentityHashMap, writeInetAddress, writeIntArray, writeInteger, writeLinkedHashMap, writeLinkedHashSet, writeLinkedList, writeLong, writeLongArray, writeNonPrimitiveClassName, writeObject, writeObject, writeObjectArray, writeObjectAsByteArray, writeOptional, writeOptionalDouble, writeOptionalInt, writeOptionalLong, 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 Details

    • EnumSerializer

      public EnumSerializer()
  • Method Details

    • toData

      public boolean toData(Object obj, DataOutput out) throws IOException
      Specified by:
      toData in class org.apache.geode.DataSerializer
      Throws:
      IOException
    • fromData

      public Object fromData(DataInput in) throws IOException, ClassNotFoundException
      Specified by:
      fromData in class org.apache.geode.DataSerializer
      Throws:
      IOException
      ClassNotFoundException
    • addEnum

      public Class<?> addEnum(Class<?> enumType)
    • setId

      public void setId(int id)
      Sets the id of this serializer. Default is 1024.
      Parameters:
      id - identifier to set on this serializer.
    • getId

      public int getId()
      Specified by:
      getId in class org.apache.geode.DataSerializer
    • getSupportedClasses

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