Interface StringOrArray

All Superinterfaces:
Comparable<StringOrArray>, Serializable
All Known Implementing Classes:
DefaultStringOrArray

public interface StringOrArray extends Serializable, Comparable<StringOrArray>
Type that represents either a String (in case of one value) or an Array (List) of Strings (in case of multiple values).
Since:
2.2.0
  • Method Details

    • getValueOrError

      Returns:
      single value, or throw an error if that was not possible.
      Throws:
      NoSingleValueException - when no or more than one values exists
    • getValueOrError

      @Nullable @Nullable String getValueOrError(Supplier<? extends NoSingleValueException> exceptionSupplier) throws NoSingleValueException
      Parameters:
      exceptionSupplier - Supplier of a NoSingleValueException that is thrown when no or more than one values exists.
      Returns:
      single value, or throw an exception when no or multiple value were present.
      Throws:
      NoSingleValueException - when no or more than one values exists
    • getValues

      List<String> getValues()
      Returns:
      a list of all the values
    • toStringOrArray

      @Nullable @Nullable Object toStringOrArray()
      Returns:
      the value as a String or ArrayList type. If no value was set, null is returned.
    • contains

      boolean contains(String value)
      Returns true if this StringOrArray contains the specified String value.
      Parameters:
      value - string value whose presence is to be tested
      Returns:
      true if this StringOrArray contains the specified value; false otherwise