Interface StringOrArray
- All Superinterfaces:
Comparable<StringOrArray>,Serializable
- All Known Implementing Classes:
DefaultStringOrArray
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 Summary
Modifier and TypeMethodDescriptionbooleanReturnstrueif this StringOrArray contains the specified String value.getValueOrError(Supplier<? extends NoSingleValueException> exceptionSupplier) Methods inherited from interface java.lang.Comparable
compareTo
-
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
- Returns:
- a list of all the values
-
toStringOrArray
- Returns:
- the value as a String or ArrayList type. If no value was set, null is returned.
-
contains
Returnstrueif this StringOrArray contains the specified String value.- Parameters:
value- string value whose presence is to be tested- Returns:
trueif this StringOrArray contains the specified value;falseotherwise
-