org.jcoderz.commons.types.samples
Class TestEnum

java.lang.Object
  extended by org.jcoderz.commons.types.samples.TestEnum
All Implemented Interfaces:
Serializable, EnumType, StrongType

public final class TestEnum
extends Object
implements Serializable, EnumType

Enumerated type of a test enum. Instances of this class are immutable. The following test enums are defined:

The values of this enum have a internal sequential integer representation starting with '0'.

Author:
generated
See Also:
Serialized Form

Field Summary
static TestEnum CLUBS
          The TestEnum Clubs.
static TestEnum DIAMONDS
          The TestEnum Diamonds.
static TestEnum HEARTS
          The TestEnum Hearts.
static TestEnum SPADES
          The TestEnum Spades.
static String TYPE_NAME
          The name of this type.
static Map VALUE_MAP
          Immutable map using the name string as key holding the TestEnums as values.
static List VALUES
          Immutable list of the TestEnums.
 
Method Summary
static TestEnum fromInt(int i)
          Creates a TestEnum object from its int representation.
static TestEnum fromString(String str)
          Creates a TestEnum object from its String representation.
 int toInt()
          Returns the int representation of this test enum.
 String toString()
          Returns the String representation of this test enum.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_NAME

public static final String TYPE_NAME
The name of this type.

See Also:
Constant Field Values

CLUBS

public static final TestEnum CLUBS
The TestEnum Clubs.


DIAMONDS

public static final TestEnum DIAMONDS
The TestEnum Diamonds.


HEARTS

public static final TestEnum HEARTS
The TestEnum Hearts.


SPADES

public static final TestEnum SPADES
The TestEnum Spades.


VALUES

public static final List VALUES
Immutable list of the TestEnums.


VALUE_MAP

public static final Map VALUE_MAP
Immutable map using the name string as key holding the TestEnums as values.

Method Detail

fromInt

public static TestEnum fromInt(int i)
                        throws ArgumentMalformedException
Creates a TestEnum object from its int representation.

Parameters:
i - the integer representation of the test enum.
Returns:
the TestEnum object represented by this int.
Throws:
ArgumentMalformedException - If the assigned int value isn't listed in the internal test enum table.

fromString

public static TestEnum fromString(String str)
                           throws ArgumentMalformedException
Creates a TestEnum object from its String representation.

Parameters:
str - the string representation of the test enum.
Returns:
the TestEnum object represented by this str.
Throws:
ArgumentMalformedException - If the given str value isn't listed in the internal test enum table.

toInt

public int toInt()
Returns the int representation of this test enum.

Specified by:
toInt in interface EnumType
Returns:
the int representation of this test enum.

toString

public String toString()
Returns the String representation of this test enum.

Overrides:
toString in class Object
Returns:
the String representation of this test enum.


Copyright 2007 The jCoderZ Project.