com.jeffpalm.util
Class TypeSafeEnum

java.lang.Object
  extended by com.jeffpalm.util.TypeSafeEnum
All Implemented Interfaces:
java.lang.Comparable
Direct Known Subclasses:
TypeSafeEnum.Boolean, TypeSafeEnum.Byte, TypeSafeEnum.Char, TypeSafeEnum.Double, TypeSafeEnum.Float, TypeSafeEnum.Int, TypeSafeEnum.Long, TypeSafeEnum.Short, TypeSafeEnum.String

public abstract class TypeSafeEnum
extends java.lang.Object
implements java.lang.Comparable


Nested Class Summary
static class TypeSafeEnum.Boolean
           
static class TypeSafeEnum.Byte
           
static class TypeSafeEnum.Char
           
static class TypeSafeEnum.Double
           
static class TypeSafeEnum.Float
           
static class TypeSafeEnum.Int
           
static class TypeSafeEnum.Long
           
static class TypeSafeEnum.Short
           
static class TypeSafeEnum.String
           
 
Constructor Summary
TypeSafeEnum()
           
 
Method Summary
abstract  java.lang.String description()
           
 TypeSafeEnum[] instances()
           
static TypeSafeEnum[] instances(java.lang.Class cls)
           
static boolean isTypeSafeEnum(java.lang.Class cls)
           
static java.lang.String makeValidFieldName(java.lang.String str)
          Modify the name of 'str' if it starts with a '_' and the rest isn't a valid java identifier.
static java.lang.String printInstances(java.lang.Class cls)
           
abstract  java.lang.String toString()
           
abstract  java.lang.Object value()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Constructor Detail

TypeSafeEnum

public TypeSafeEnum()
Method Detail

value

public abstract java.lang.Object value()

toString

public abstract java.lang.String toString()
Overrides:
toString in class java.lang.Object

description

public abstract java.lang.String description()

isTypeSafeEnum

public static final boolean isTypeSafeEnum(java.lang.Class cls)

printInstances

public static final java.lang.String printInstances(java.lang.Class cls)

instances

public static final TypeSafeEnum[] instances(java.lang.Class cls)

instances

public final TypeSafeEnum[] instances()

makeValidFieldName

public static java.lang.String makeValidFieldName(java.lang.String str)
Modify the name of 'str' if it starts with a '_' and the rest isn't a valid java identifier. That is the way we can use numbers and keywords as pseudo names for type safe enums