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>

public abstract sealed class NumericField<N extends Number> extends AbstractField<N>
  • Field Details

  • Constructor Details

    • NumericField

      protected NumericField(String name, studio.mevera.imperat.util.TypeWrap<N> type)
      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

      public static NumericField<Integer> integerField(String name)
    • doubleField

      public static NumericField<Double> doubleField(String name)
    • floatField

      public static NumericField<Float> floatField(String name)
    • longField

      public static NumericField<Long> longField(String name)
    • shortField

      public static NumericField<Short> shortField(String name)
    • byteField

      public static NumericField<Byte> byteField(String name)
    • 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 parsed
      context - 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