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 Details

    • 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 be null)
      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 be null)
      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