com.h3c.util.persistence.cassandra.entitymgr.column

## Class EnumColumn.EnumColumnDecoder<K extends Serializable & Comparable<K>,E extends Enum<E>>

- java.lang.Object
- - com.h3c.util.persistence.cassandra.entitymgr.column.EnumColumn.EnumColumnDecoder<K,E>

- Type Parameters:
    `K` - type of the column key or name
    `E` - type of the enumeration
  All Implemented Interfaces:
    Decoder<Column<K,E>,com.netflix.astyanax.model.Column<K>>, ColumnDecoder<K,E>
  Enclosing class:
    EnumColumn<K extends Serializable & Comparable<K>,E extends Enum<E>>

      public static final class EnumColumn.EnumColumnDecoder<K extends Serializable & Comparable<K>,E extends Enum<E>>
      extends Object
      implements ColumnDecoder<K,E>

  Enum column decoder.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `EnumColumn.EnumColumnDecoder(Class<E> enumClass)` Creates an enumeration decoder.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Column<K,E>` | `decode(com.netflix.astyanax.model.Column<K> code)` The enum is encoded to String and decoded from String using the constant name.
    `static <E extends Enum<E>> E` | `decode(String code, Class<E> enumClass)` Decodes an enumeration.
    `static String` | `encode(Enum<?> value)` Encodes an enumeration.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### EnumColumn.EnumColumnDecoder

          public EnumColumn.EnumColumnDecoder(Class<E> enumClass)

      Creates an enumeration decoder.
      Parameters:
        `enumClass` - enumeration class

  - ### Method Detail

    - #### decode

          public Column<K,E> decode(com.netflix.astyanax.model.Column<K> code)
                                                                                 throws IllegalArgumentException

      The enum is encoded to String and decoded from String using the constant name.
      Specified by:
        `decode` in interface `Decoder<Column<K extends Serializable & Comparable<K>,E extends Enum<E>>,com.netflix.astyanax.model.Column<K extends Serializable & Comparable<K>>>`
      Parameters:
        `code` - com.netflix.astyanax.model.Column
      Returns:
        Column
      Throws:
        `IllegalArgumentException`

    - #### encode

          public static String encode(Enum<?> value)

      Encodes an enumeration.
      Parameters:
        `value` - enumeration constant
      Returns:
        the code for the enumeration

    - #### decode

          public static <E extends Enum<E>> E decode(String code,
                                     Class<E> enumClass)

      Decodes an enumeration.
      Parameters:
        `code` - code
        `enumClass` - enumeration class
      Returns:
        the enumeration value

Copyright © 2014. All Rights Reserved.