com.uwyn.rife.datastructures
Class EnumClass<IdentifierType>

java.lang.Object
  extended by com.uwyn.rife.datastructures.EnumClass<IdentifierType>
Direct Known Subclasses:
ArrayUtils.ArrayType, ConstrainedBean.Direction, CreateTable.Nullable, CreateTable.ViolationAction, ElementInfoProcessorFactory, ElementType, FormStateType, MimeType, OrdinalManager.Direction, PathInfoMode, QueryParameterType, RequestMethod, Scope, Select.JoinCondition, Select.JoinType, Select.OrderByDirection, SequenceValue.Operation, SiteProcessorFactory, StringEncryptor, StringUtils.BbcodeOption, TemplateFactory

public abstract class EnumClass<IdentifierType>
extends Object

The purpose of this abstract base class is to allow the creation of type-safe enumerations.

Only the derived class is allowed to create instances and should do so as public static final objects.

Each instance of a EnumClass class needs an identifier to its constructor. This identifier is used to uniquely differentiate enumeration members amongst each-other.

Since:
1.0
Version:
$Revision: 3634 $
Author:
Geert Bevin (gbevin[remove] at uwyn dot com)

Field Summary
protected  IdentifierType mIdentifier
           
 
Constructor Summary
protected EnumClass(Class klass, IdentifierType identifier)
           
protected EnumClass(IdentifierType identifier)
           
 
Method Summary
 boolean equals(Object object)
           
protected static Collection<?> getIdentifiers(Class<? extends EnumClass> type)
           
protected static
<MemberType extends EnumClass>
MemberType
getMember(Class<MemberType> type, Object identifier)
           
protected static Collection<? extends EnumClass> getMembers(Class<? extends EnumClass> type)
           
 int hashCode()
           
protected  void registerType(Class klass, IdentifierType identifier)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

mIdentifier

protected IdentifierType mIdentifier
Constructor Detail

EnumClass

protected EnumClass(IdentifierType identifier)

EnumClass

protected EnumClass(Class klass,
                    IdentifierType identifier)
Method Detail

registerType

protected final void registerType(Class klass,
                                  IdentifierType identifier)

getIdentifiers

protected static Collection<?> getIdentifiers(Class<? extends EnumClass> type)

getMembers

protected static Collection<? extends EnumClass> getMembers(Class<? extends EnumClass> type)

getMember

protected static <MemberType extends EnumClass> MemberType getMember(Class<MemberType> type,
                                                                     Object identifier)

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object object)
Overrides:
equals in class Object


Copyright © 2001-2007 Uwyn sprl/bvba. All Rights Reserved.