Class StringEnumeration
java.lang.Object
org.wildfly.security.util.StringEnumeration
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
Modifier and TypeMethodDescriptioncanonicalName(String str) Get the canonical name for a string.intGet the numeric index for a string.nameOf(int index) Get the canonical name for an index.static StringEnumerationConstruct a new instance.intsize()Get the size of this enumeration.
-
Method Details
-
of
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
-
indexOf
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
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
-