|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jibx.runtime.EnumSet
public class EnumSet
Named value set support class. This provides convenience methods to support
working with a set of named static final int
values, including
translating them to and from String
representations. It's
intended for use with relatively small nonnegative int values.
Nested Class Summary | |
---|---|
static class |
EnumSet.EnumItem
Enumeration pair information. |
Field Summary | |
---|---|
private java.lang.String[] |
m_indexedNames
Enumeration names in index number order. |
private EnumSet.EnumItem[] |
m_items
Actual item definitions (used for extensions). |
private int[] |
m_orderedIndexes
Index values corresponding to sorted names. |
private java.lang.String[] |
m_orderedNames
Enumeration names in sort order. |
static int |
VALUE_LIMIT
Maximum int value supported for enumerations. |
Constructor Summary | |
---|---|
EnumSet(EnumSet.EnumItem[] items)
Constructor from array of enumeration items. |
|
EnumSet(EnumSet base,
int start,
java.lang.String[] names)
Constructor from existing enumeration with added names. |
|
EnumSet(int start,
java.lang.String[] names)
Constructor from array of names. |
Method Summary | |
---|---|
private static EnumSet.EnumItem[] |
buildItems(int start,
java.lang.String[] names)
Generate array of enumeration items from array of names. |
void |
checkValue(int value)
Check value with exception. |
java.lang.String |
getName(int value)
Get name for value if defined. |
java.lang.String |
getNameChecked(int value)
Get name for value. |
int |
getValue(java.lang.String name)
Get value for name if defined. |
int |
getValueChecked(java.lang.String name)
Get value for name. |
int |
maxIndex()
Get maximum index value in enumeration set. |
private static EnumSet.EnumItem[] |
mergeItems(EnumSet base,
int start,
java.lang.String[] names)
Generate array of enumeration items from base enumeration and array of names. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int VALUE_LIMIT
int
value supported for enumerations.
private final EnumSet.EnumItem[] m_items
private final java.lang.String[] m_indexedNames
private final java.lang.String[] m_orderedNames
private final int[] m_orderedIndexes
Constructor Detail |
---|
public EnumSet(EnumSet.EnumItem[] items)
items
- array of enumeration items (will be reordered)public EnumSet(int start, java.lang.String[] names)
start
- item value for first added namenames
- array of names (no null
entries allowed)public EnumSet(EnumSet base, int start, java.lang.String[] names)
base
- base enumeration to be extendedstart
- item value for first added namenames
- array of names (no null
entries allowed)Method Detail |
---|
private static EnumSet.EnumItem[] buildItems(int start, java.lang.String[] names)
start
- item value for first added namenames
- array of names (no null
entries allowed)private static EnumSet.EnumItem[] mergeItems(EnumSet base, int start, java.lang.String[] names)
base
- base enumeration to be extendedstart
- item value for first added namenames
- array of names (no null
entries allowed)public java.lang.String getName(int value)
value
- enumeration value
null
if not definedpublic java.lang.String getNameChecked(int value)
value
- enumeration value
public int getValue(java.lang.String name)
name
- possible enumeration name
-1
if not found in enumerationpublic int getValueChecked(java.lang.String name)
name
- enumeration name
public void checkValue(int value)
value
- public int maxIndex()
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |