Module io.github.darvil.lanat
Package io.github.darvil.lanat.argtypes
Class KeyValuesArgumentType<Type extends ArgumentType<TInner>,TInner>
java.lang.Object
io.github.darvil.lanat.utils.errors.ErrorContainerImpl<ArgumentTypeError>
io.github.darvil.lanat.ArgumentType<Map<String,TInner>>
io.github.darvil.lanat.argtypes.KeyValuesArgumentType<Type,TInner>
- Type Parameters:
Type- The type of the argument type used to parse the values.TInner- The type of the values.
- All Implemented Interfaces:
Parseable<Map<String,,TInner>> ErrorContainer<ArgumentTypeError>,NamedWithDescription,ParentElementGetter<ArgumentType<?>>,PostCreationInheritor<Command>,Resettable
public class KeyValuesArgumentType<Type extends ArgumentType<TInner>,TInner>
extends ArgumentType<Map<String,TInner>>
An argument type that takes key-value pairs. The key is a string, and the value is of the argument type given in the
constructor. The key-value pairs are separated by an equals sign (e.g.
key=value).
The final value of this argument type is a HashMap of the key-value pairs.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class io.github.darvil.lanat.ArgumentType
ArgumentType.ParseStateSnapshot -
Constructor Summary
ConstructorsConstructorDescriptionKeyValuesArgumentType(Type argumentType) Creates a new key-values argument type. -
Method Summary
Modifier and TypeMethodDescription@Nullable StringReturns the description of this object.@NotNull io.github.darvil.terminal.textformatter.TextFormatterReturns the representation of this parseable type.@NotNull io.github.darvil.utils.RangeSpecifies the number of values that this parser should receive when callingParseable.parseValues(String[]).parseValues(String @NotNull [] values) Parses the received values and returns the result.Methods inherited from class io.github.darvil.lanat.ArgumentType
addError, addError, addError, addError, addError, getArgValuesStream, getFinalValue, getInitialValue, getLastParseState, getParent, getValue, inheritProperties, onSubTypeError, parseAndUpdateValue, registerSubType, resetState, setInitialValue, unregisterSubTypeMethods inherited from class io.github.darvil.lanat.utils.errors.ErrorContainerImpl
getErrorDisplayThreshold, getErrorExitThreshold, getErrorsUnderDisplayThreshold, getErrorsUnderExitThreshold, getErrorsUnderThreshold, hasDisplayErrors, hasExitErrors, setErrorDisplayThreshold, setErrorExitThresholdMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.github.darvil.lanat.utils.ParentElementGetter
getRoot, isRootMethods inherited from interface io.github.darvil.lanat.argtypes.Parseable
getName, getUsageCountBounds
-
Constructor Details
-
KeyValuesArgumentType
Creates a new key-values argument type.- Parameters:
argumentType- The argument type used to parse the values.
-
-
Method Details
-
getValueCountBounds
@NotNull public @NotNull io.github.darvil.utils.Range getValueCountBounds()Description copied from interface:ParseableSpecifies the number of values that this parser should receive when callingParseable.parseValues(String[]). By default, this is 1. (Range.ONE). -
parseValues
Description copied from interface:ParseableParses the received values and returns the result. If the values are invalid, this method shall returnnull.- Parameters:
values- The values that were received.- Returns:
- The parsed value.
-
getRepresentation
@NotNull public @NotNull io.github.darvil.terminal.textformatter.TextFormatter getRepresentation()Description copied from interface:ParseableReturns the representation of this parseable type. This may appear in places like the help message. -
getDescription
Description copied from interface:NamedWithDescriptionReturns the description of this object.- Returns:
- The description of this object
-