Class StringGetter

All Implemented Interfaces:
Serializable, Cloneable, Map<Object,Object>, Getter
Direct Known Subclasses:
CxfMode

public class StringGetter extends SerialGetter
This class extends SerialGetter and implements the Getter interface and is used to easily store strings associations that in this way becomes easy to extract.
See Also:
  • Field Details

    • DEFAULT_DELIMITER

      public static final String DEFAULT_DELIMITER
      The default string used to separate each entry of the StringGetter from the others
      See Also:
    • DEFAULT_ASSIGNER

      public static final String DEFAULT_ASSIGNER
      The default string used to make the association key,value that determines an entry of the StringGetter
      See Also:
    • delimiter

      protected String delimiter
    • assigner

      protected String assigner
    • trimParts

      protected boolean trimParts
  • Constructor Details

    • StringGetter

      public StringGetter()
      Creates a new empty StringGetter
    • StringGetter

      public StringGetter(boolean ignoreCase)
      Creates a new empty StringGetter, key sensitive or not depending on the value of the parameter
      Parameters:
      ignoreCase - false to create a key sensitive StringGetter, true otherwise
    • StringGetter

      public StringGetter(boolean ignoreCase, boolean trimParts)
      Creates a new empty StringGetter
      Parameters:
      ignoreCase - false to create a key sensitive StringGetter, true otherwise
      trimParts - true to create a StringGetter that omits the leading and trailing whitespaces of both keys and values, false otherwise
    • StringGetter

      public StringGetter(String delim, String assign, boolean ignoreCase)
      Creates a new empty StringGetter
      Parameters:
      delim - The string used to separate each entry of the StringGetter from the others
      assign - The string used to make the association key,value that determines an entry of the StringGetter
      ignoreCase - false to create a key sensitive StringGetter, true otherwise
    • StringGetter

      public StringGetter(String values, String delim, String assign)
      Creates a StringGetter and fills it with the values defined by the string passed as parameter
      Parameters:
      values - The string that defines the entries for the StringGetter. For example (using the standard values for the delimiter and assigner strings): "A=B,C=D"
      delim - The string used to separate each entry of the StringGetter from the others
      assign - The string used to make the association key,value that determines an entry of the StringGetter
    • StringGetter

      public StringGetter(String delim, String assign)
      Creates a new empty StringGetter
      Parameters:
      delim - The string used to separate each entry of the StringGetter from the others
      assign - The string used to make the association key,value that determines an entry of the StringGetter
    • StringGetter

      public StringGetter(String s)
      Creates a StringGetter and fills it with the values defined by the string passed as parameter
      Parameters:
      s - The string that defines the entries for the StringGetter. For example (using the standard values for the delimiter and assigner strings): "A=B,C=D"
    • StringGetter

      public StringGetter(String... values)
      Creates a StringGetter and fills it with the values defined by the string's array passed as parameter
      Parameters:
      values - The string's array that defines the entries for the StringGetter. For example (using the standard values for the assigner strings) each entry must respect the format key=value
    • StringGetter

      public StringGetter(String s, boolean ignoreCase)
      Creates a StringGetter and fills it with the values defined by the string passed as parameter
      Parameters:
      s - The string that defines the entries for the StringGetter. For example (using the standard values for the delimiter and assigner strings): "A=B,C=D"
      ignoreCase - false to create a key sensitive StringGetter, true otherwise
  • Method Details

    • setValues

      public void setValues(String values)
      Sets the values of the StringGetter. Each entry of the StringGetter is defined by a key value pair separated by the assigner string (see getAssigner()). Each entry is separated from the others by the delimiter string (see getDelimiter()).
      Parameters:
      values - The string that defines the entries for the StringGetter. For example (using the standard values for the delimiter and assigner strings): "A=B,C=D"
    • setValues

      public void setValues(String... values)
      Sets the values of the StringGetter. Each entry is separated from the others by the delimiter string (see getDelimiter()).
      Parameters:
      values - The array of string that defines the entries for the StringGetter. For example (using the standard values for the assigner strings) each entry must respect the format key=value
    • getDelimiter

      public String getDelimiter()
      Returns the string used to separate each entry of the StringGetter from the others
      Returns:
      The string used to separate each entry; the default is the comma character (,)
    • getAssigner

      public String getAssigner()
      Returns the string used to make the association key,value that determines an entry of the StringGetter
      Returns:
      The string used to make the key,value association; the default is the equal character (=)
    • toString

      public String toString()
      Returns the string representation of the StringGetter
      Overrides:
      toString in class Properties
      Returns:
      The string representation of the StringGetter
    • getString

      public String getString(String key, String def)
      Returns the string value associated to the key, or the default one passed as parameter if there isn't an entry with the specified key
      Specified by:
      getString in interface Getter
      Overrides:
      getString in class SerialGetter
      Parameters:
      key - The key used to search the value in the StringGetter
      def - The default value returned if there isn't the desired entry
      Returns:
      The value associated to the key, or the default one