Class CustomStringListCommandParameter

All Implemented Interfaces:
Cloneable

public class CustomStringListCommandParameter extends StringListCommandParameter
This class extends the string list command parameter with functionality to define valid strings with regular expressions.
Author:
Bastian Wolf
See Also:
  • Constructor Details

    • CustomStringListCommandParameter

      public CustomStringListCommandParameter(String id, String des)
      constructor for the custom string list parameter with id and description
      Parameters:
      id - the identification string of this parameter
      des - the description of this parameter
    • CustomStringListCommandParameter

      public CustomStringListCommandParameter(String id, String des, String criteria)
      constructor for the custom string list parameter with id, description and criteria
      Parameters:
      id - the identification string of this parameter
      des - the description of this parameter
      criteria - the validation criteria for this parameter
  • Method Details

    • getValue

      public String[] getValue()
      Getter of value
      Overrides:
      getValue in class StringListCommandParameter
      Returns:
      value
    • getCriteria

      public String getCriteria()
      Getter of criteria
      Returns:
      criteria
    • setValue

      public void setValue(String[] value)
      Sets the value of this object.
      Overrides:
      setValue in class StringListCommandParameter
      Parameters:
      value - a `String[]` representing the new value to be stored in this object.
    • setCriteria

      public void setCriteria(String criteria)
      Sets the criteria for this object.
      Parameters:
      criteria - a `String` representing the criteria to be set for this object.
    • isValid

      public boolean isValid(String s)
      valid iff string matches criteria
      Overrides:
      isValid in class StringListCommandParameter
      Parameters:
      s - the given input string
      Returns:
      true if valid, false if not
    • instantiate

      public CommandParameter instantiate(String s)
      instantiate single string
      Overrides:
      instantiate in class StringListCommandParameter
      Parameters:
      s - the given string to instantiate
      Returns:
      parameter
    • instantiate

      public CommandParameter instantiate(String[] s)
      instantiates a list of arguments if valid
      Overrides:
      instantiate in class StringListCommandParameter
      Parameters:
      s - the given strings array to instantiate
      Returns:
      instantiated parameter if input is valid,
    • clone

      public Object clone()
      method to clone this object for instantiation
      Overrides:
      clone in class StringListCommandParameter