Package org.wildfly.security.util
Class StringEnumeration
- java.lang.Object
-
- org.wildfly.security.util.StringEnumeration
-
public final class StringEnumeration extends Object
An indexed enumeration of strings. The enumeration can look up string indexes by number, numeric indexes by string, or retrieve the interned string value by name.- Author:
- David M. Lloyd
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringcanonicalName(String str)Get the canonical name for a string.intindexOf(String str)Get the numeric index for a string.StringnameOf(int index)Get the canonical name for an index.static StringEnumerationof(String... values)Construct a new instance.intsize()Get the size of this enumeration.
-
-
-
Method Detail
-
of
public static StringEnumeration of(String... values)
Construct a new instance. The given values are used as the string members in the order they are given.- Parameters:
values- the values- Returns:
- the string enumeration
-
canonicalName
public String canonicalName(String str)
Get the canonical name for a string. If the string is not found, an exception is thrown.- Parameters:
str- the string to look up (must not benull)- Returns:
- the canonical name (not
null)
-
indexOf
public int indexOf(String str)
Get the numeric index for a string. If the string is not found, an exception is thrown.- Parameters:
str- the string to look up (must not benull)- Returns:
- the numeric index
-
nameOf
public String nameOf(int index)
Get the canonical name for an index. If the index is out of range, an exception is thrown.- Parameters:
index- the index to seek- Returns:
- the canonical name (not
null)
-
size
public int size()
Get the size of this enumeration.- Returns:
- the size of this enumeration
-
-