Class StringChoices


  • public class StringChoices
    extends java.lang.Object
    StringEnum objects represent a choice from a limited set of options.
    • Field Summary

      Fields 
      ChangeModifier and Type Field Description
      NEWprotected int selected  
      NEWprotected java.lang.String[] values  
    • Constructor Summary

      Constructors 
      ChangeConstructor Description
      StringChoices​(StringChoices strEnum)
      Construct from another StringEnum instance.
      StringChoices​(java.lang.String[] values)
      Construct from an array of Strings.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      ChangeModifier and Type Method Description
      boolean contains​(java.lang.String value)
      Returns true if the given value is contained in this StringEnum
      boolean equals​(java.lang.Object obj)  
      java.lang.String getSelectedValue()
      Returns the currently selected value.
      int getSelectedValueIndex()
      Returns the index of the currently selected value;
      java.lang.String[] getValues()
      Returns a list of all allowed string values.
      int hashCode()  
      int indexOf​(java.lang.String value)
      Returns the index of the given value in this StringEnum; -1 if the value is not contained herein.
      void setSelectedValue​(int index)
      Sets the current value to the object at the given position as if indexed into the array returned by getValues().
      void setSelectedValue​(java.lang.String value)
      Sets the currentValue to the given value.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • values NEW

        protected java.lang.String[] values
      • selected NEW

        protected int selected

Constructor Detail

  • Method Detail

    • getValues

      public java.lang.String[] getValues()
      Returns a list of all allowed string values.
    • getSelectedValue

      public java.lang.String getSelectedValue()
      Returns the currently selected value.
    • getSelectedValueIndex

      public int getSelectedValueIndex()
      Returns the index of the currently selected value;
    • contains

      public boolean contains​(java.lang.String value)
      Returns true if the given value is contained in this StringEnum
      Parameters:
      value - The value for which to search
      Returns:
      true if the given value is contained in this StringEnum
    • indexOf

      public int indexOf​(java.lang.String value)
      Returns the index of the given value in this StringEnum; -1 if the value is not contained herein.
      Parameters:
      value - The value for which to search
      Returns:
      the index of the given value in this StringEnum; -1 if the value is not contained herein.
    • setSelectedValue

      public void setSelectedValue​(java.lang.String value)
      Sets the currentValue to the given value.
      Throws:
      java.lang.IllegalArgumentException - thrown if the given value is not one of the set of allowed values.
    • setSelectedValue

      public void setSelectedValue​(int index)
      Sets the current value to the object at the given position as if indexed into the array returned by getValues().
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • equals

      public boolean equals​(java.lang.Object obj)
      Overrides:
      equals in class java.lang.Object
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
      See Also:
      Object.toString()