Class ParserParameters
- java.lang.Object
-
- cloud.commandframework.arguments.parser.ParserParameters
-
public final class ParserParameters extends java.lang.ObjectCollection ofparameter-objectpairs
-
-
Constructor Summary
Constructors Constructor Description ParserParameters()
-
Method Summary
Modifier and Type Method Description static @NonNull ParserParametersempty()Get an emptyParserParametersinstance<T> @NonNull Tget(@NonNull ParserParameter<T> parameter, @NonNull T defaultValue)Get a value from the parameter map, if it is stored, else return a default value@NonNull java.util.Map<@NonNull ParserParameter<?>,@NonNull java.lang.Object>getAll()Get an immutable view of the internal map<T> booleanhas(@NonNull ParserParameter<T> parameter)Check if this instance contains a parameter-object pair for a given parametervoidmerge(@NonNull ParserParameters other)Attempt to merge twoParserParametersinstances.static <T> @NonNull ParserParameterssingle(@NonNull ParserParameter<T> parameter, @NonNull T value)Create aParserParametersinstance containing a single key-value par<T> voidstore(@NonNull ParserParameter<T> parameter, @NonNull T value)Store a parameter-object pair
-
-
-
Method Detail
-
empty
public static @NonNull ParserParameters empty()
Get an emptyParserParametersinstance- Returns:
- Empty instance
-
single
public static <T> @NonNull ParserParameters single(@NonNull ParserParameter<T> parameter, @NonNull T value)
Create aParserParametersinstance containing a single key-value par- Type Parameters:
T- Value type- Parameters:
parameter- Parametervalue- Value- Returns:
- Constructed instance
-
has
public <T> boolean has(@NonNull ParserParameter<T> parameter)
Check if this instance contains a parameter-object pair for a given parameter- Type Parameters:
T- Parameter type- Parameters:
parameter- Parameter- Returns:
trueif such a pair is stored, elsefalse
-
store
public <T> void store(@NonNull ParserParameter<T> parameter, @NonNull T value)
Store a parameter-object pair- Type Parameters:
T- Parameter type- Parameters:
parameter- Parametervalue- Object
-
get
public <T> @NonNull T get(@NonNull ParserParameter<T> parameter, @NonNull T defaultValue)
Get a value from the parameter map, if it is stored, else return a default value- Type Parameters:
T- Parameter type- Parameters:
parameter- Parameter to retrievedefaultValue- Default value- Returns:
- Parameter value
-
merge
public void merge(@NonNull ParserParameters other)
Attempt to merge twoParserParametersinstances. If the instances contain conflicting values, the values of the "other" instance will be preferred- Parameters:
other- Other instance
-
getAll
public @NonNull java.util.Map<@NonNull ParserParameter<?>,@NonNull java.lang.Object> getAll()
Get an immutable view of the internal map- Returns:
- Immutable map
-
-