Class FlagContainer
java.lang.Object
de.chojo.jdautil.wrapper.FlagContainer
-
Method Summary
Modifier and TypeMethodDescription<T> TGet the value for a flag.@Nullable StringGet the value for the flag.<T> Optional<T> getIfPresent(@NotNull String flag, Function<String, T> map) Get the value if present parsed with the mapping function.getIfPresent(String flag) Get the flag value if the value is presentbooleanCheck if a flag is present in the container.booleanCheck if the flag has a value defined.static FlagContainerCreate a new flag container based on the arguments
-
Method Details
-
of
Create a new flag container based on the arguments- Parameters:
args- args- Returns:
- new flag container with parsed args
-
has
Check if a flag is present in the container.- Parameters:
flag- flag to check- Returns:
- true if flag is present
-
hasValue
Check if the flag has a value defined.- Parameters:
flag- flag to check- Returns:
- true if a value is present
-
get
-
get
-
getIfPresent
-
getIfPresent
Get the value if present parsed with the mapping function.If the value is not present the mapping function will not be applied and a empty optional will be returned.
- Type Parameters:
T- type of returned optional- Parameters:
flag- flag to retrievemap- function to map the flag- Returns:
- flag value parsed and wrapped into an optional
-