org.jcoderz.commons.types.samples
Class TestEnumAsString

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

public final class TestEnumAsString
extends Object
implements Serializable, EnumType

Enumerated type of a test enum as string. Instances of this class are immutable. The following test enum as strings 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 TestEnumAsString CLUBS
          The TestEnumAsString Clubs.
static TestEnumAsString DIAMONDS
          The TestEnumAsString Diamonds.
static TestEnumAsString HEARTS
          The TestEnumAsString Hearts.
static TestEnumAsString SPADES
          The TestEnumAsString Spades.
static String TYPE_NAME
          The name of this type.
static Map VALUE_MAP
          Immutable map using the name string as key holding the TestEnumAsStrings as values.
static List VALUES
          Immutable list of the TestEnumAsStrings.
 
Method Summary
static TestEnumAsString fromInt(int i)
          Creates a TestEnumAsString object from its int representation.
static TestEnumAsString fromString(String str)
          Creates a TestEnumAsString object from its String representation.
 int toInt()
          Returns the int representation of this test enum as string.
 String toString()
          Returns the String representation of this test enum as string.
 
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 TestEnumAsString CLUBS
The TestEnumAsString Clubs.


DIAMONDS

public static final TestEnumAsString DIAMONDS
The TestEnumAsString Diamonds.


HEARTS

public static final TestEnumAsString HEARTS
The TestEnumAsString Hearts.


SPADES

public static final TestEnumAsString SPADES
The TestEnumAsString Spades.


VALUES

public static final List VALUES
Immutable list of the TestEnumAsStrings.


VALUE_MAP

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

Method Detail

fromInt

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

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

fromString

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

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

toInt

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

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

toString

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

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


Copyright 2007 The jCoderZ Project.