Class CollectionArgumentChoice<E>

  • All Implemented Interfaces:
    ArgumentChoice

    public class CollectionArgumentChoice<E>
    extends java.lang.Object
    implements ArgumentChoice

    Choice from given collection of values.

    contains(Object) checks given val is contained in values given in constructor argument.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Collection<E> values_  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean contains​(java.lang.Object val)
      Returns true iff val is valid choice according to this object's constraint.
      java.lang.String textualFormat()
      Return textual representation of this choice.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • values_

        private final java.util.Collection<E> values_
    • Constructor Detail

      • CollectionArgumentChoice

        @SafeVarargs
        public CollectionArgumentChoice​(E... values)
        Initializes this object from given values.
        Parameters:
        values - Valid values
      • CollectionArgumentChoice

        public CollectionArgumentChoice​(java.util.Collection<E> values)
        Initializes this object from given values.
        Parameters:
        values - Valid values
    • Method Detail

      • contains

        public boolean contains​(java.lang.Object val)
        Description copied from interface: ArgumentChoice

        Returns true iff val is valid choice according to this object's constraint.

        If the objects derived from RuntimeException are thrown because of invalid input from command line, subclass must catch these exceptions and return false.

        Specified by:
        contains in interface ArgumentChoice
        Parameters:
        val - The attribute value.
        Returns:
        true or false.
      • textualFormat

        public java.lang.String textualFormat()
        Description copied from interface: ArgumentChoice

        Return textual representation of this choice.

        This string will be used in help and error messages.

        Specified by:
        textualFormat in interface ArgumentChoice
        Returns:
        The textual representation of this choice.
      • toString

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