public abstract class IlEnum extends Object
This is the parent class of all symbolic enumeration classes.
To declare an enumeration C
, declare a class C
as follows:
class C extends IlEnum { public static C c1; ... public static C cn; public static IlEnumInfo metainfo = new IlEnumInfo(c.lass); }
The call to the IlEnumInfo
class will perform all the
necessary magic to assign distinct values to
c1
, ..., cn
.
Note: If you define a subclass D
of C
,
the enum
tags defined in D
will be listed in
C.metainfo.elements()
, although they are not statically
accessible as fields in class C
.
The enum
tags may have a name. The name
is usually the same as the name of field in the enum
class.
If you want to access an element from the enumeration by its name, you
can use the IlEnumInfo.get(String name)
method. To get the
IlEnumInfo
instance corresponding to your IlEnum, you can
use the method IlEnumInfo.FromClass(Class class)
.
IlEnumInfo
Modifier and Type | Field and Description |
---|---|
static IlEnumInfo |
metainfo
Contains metainformation about this
IlEnum class. |
Modifier | Constructor and Description |
---|---|
protected |
IlEnum()
Constructor
|
Modifier and Type | Method and Description |
---|---|
String |
getName()
Returns the name of this enumeration tag.
|
IlEnum |
intern()
Returns a canonical representation for this object.
|
protected void |
setName(String name)
Sets the name of this enumeration tag.
|
String |
toString()
Returns the String representation of this IlEnum's values.
|
public static final IlEnumInfo metainfo
IlEnum
class.public String getName()
protected void setName(String name)
public IlEnum intern()
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.