Class NumericField<N extends Number>
java.lang.Object
studio.mevera.imperat.selector.field.AbstractField<N>
studio.mevera.imperat.selector.field.NumericField<N>
- All Implemented Interfaces:
SelectionField<N>
-
Field Summary
FieldsFields inherited from class studio.mevera.imperat.selector.field.AbstractField
name, suggestions, typeFields inherited from interface studio.mevera.imperat.selector.field.SelectionField
SEPARATOR, VALUE_EQUALS -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedNumericField(String name, studio.mevera.imperat.util.TypeWrap<N> type) Constructs an AbstractField instance with the specified name and type. -
Method Summary
Modifier and TypeMethodDescriptionstatic NumericField<Byte>static NumericField<Double>doubleField(String name) static NumericField<Float>floatField(String name) static NumericField<Integer>integerField(String name) static NumericField<Long>parseFieldValue(String value, studio.mevera.imperat.context.CommandContext<BukkitCommandSource> context) Parses the given string representation of the value and converts it into the field's value type.protected abstract NparseNumber(String value, studio.mevera.imperat.context.CommandContext<BukkitCommandSource> ctx) static NumericField<Short>shortField(String name) Methods inherited from class studio.mevera.imperat.selector.field.AbstractField
getName, getSuggestions, getValueType
-
Field Details
-
ALL
-
-
Constructor Details
-
NumericField
Constructs an AbstractField instance with the specified name and type.- Parameters:
name- The name of the selection field.type- The type information of the value that this field handles, wrapped in a TypeWrap object.
-
-
Method Details
-
integerField
-
doubleField
-
floatField
-
longField
-
shortField
-
byteField
-
parseFieldValue
public N parseFieldValue(String value, studio.mevera.imperat.context.CommandContext<BukkitCommandSource> context) throws studio.mevera.imperat.exception.CommandException Parses the given string representation of the value and converts it into the field's value type.- Parameters:
value- the string representation of the value to be parsedcontext- the context- Returns:
- the parsed value of the field's type
- Throws:
studio.mevera.imperat.exception.CommandException- if the parsing fails
-
parseNumber
protected abstract N parseNumber(String value, studio.mevera.imperat.context.CommandContext<BukkitCommandSource> ctx) throws studio.mevera.imperat.exception.CommandException - Throws:
studio.mevera.imperat.exception.CommandException
-