Record Class ArgumentMapping

java.lang.Object
java.lang.Record
com.ultikits.ultitools.command.engine.ArgumentMapping

record ArgumentMapping(Class<?> javaType, boolean greedy, com.mojang.brigadier.arguments.ArgumentType<?> type, NativeArgumentTypes nativeTypes) extends Record
One declared Java parameter and its node's parse/result representation.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final boolean
    The field for the greedy record component.
    private final Class<?>
    The field for the javaType record component.
    private final NativeArgumentTypes
    The field for the nativeTypes record component.
    private final com.mojang.brigadier.arguments.ArgumentType<?>
    The field for the type record component.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ArgumentMapping(Class<?> javaType, boolean greedy, com.mojang.brigadier.arguments.ArgumentType<?> type, NativeArgumentTypes nativeTypes)
    Creates an instance of a ArgumentMapping record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    boolean
    Returns the value of the greedy record component.
    final int
    Returns a hash code value for this object.
    Returns the value of the javaType record component.
    private static Object
    narrow(Class<?> type, Object value)
     
    private static com.mojang.brigadier.arguments.ArgumentType<?>
     
    Returns the value of the nativeTypes record component.
    private static com.mojang.brigadier.arguments.ArgumentType<?>
    numeric(Class<?> type)
     
    (package private) static ArgumentMapping
    of(Class<?> type, boolean greedy, NativeArgumentTypes nativeTypes)
     
    (package private) String
     
    private static com.mojang.brigadier.arguments.ArgumentType<?>
    single(Class<?> type, NativeArgumentTypes nativeTypes)
     
    final String
    Returns a string representation of this record class.
    com.mojang.brigadier.arguments.ArgumentType<?>
    Returns the value of the type record component.
    (package private) Object
    value(com.mojang.brigadier.context.CommandContext<io.papermc.paper.command.brigadier.CommandSourceStack> context, String name, boolean empty)
     

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • javaType

      private final Class<?> javaType
      The field for the javaType record component.
    • greedy

      private final boolean greedy
      The field for the greedy record component.
    • type

      private final com.mojang.brigadier.arguments.ArgumentType<?> type
      The field for the type record component.
    • nativeTypes

      private final NativeArgumentTypes nativeTypes
      The field for the nativeTypes record component.
  • Constructor Details

    • ArgumentMapping

      ArgumentMapping(Class<?> javaType, boolean greedy, com.mojang.brigadier.arguments.ArgumentType<?> type, NativeArgumentTypes nativeTypes)
      Creates an instance of a ArgumentMapping record class.
      Parameters:
      javaType - the value for the javaType record component
      greedy - the value for the greedy record component
      type - the value for the type record component
      nativeTypes - the value for the nativeTypes record component
  • Method Details

    • of

      static ArgumentMapping of(Class<?> type, boolean greedy, NativeArgumentTypes nativeTypes)
    • single

      private static com.mojang.brigadier.arguments.ArgumentType<?> single(Class<?> type, NativeArgumentTypes nativeTypes)
    • numeric

      private static com.mojang.brigadier.arguments.ArgumentType<?> numeric(Class<?> type)
    • narrowPrimitive

      private static com.mojang.brigadier.arguments.ArgumentType<?> narrowPrimitive(Class<?> type)
    • value

      Object value(com.mojang.brigadier.context.CommandContext<io.papermc.paper.command.brigadier.CommandSourceStack> context, String name, boolean empty) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • narrow

      private static Object narrow(Class<?> type, Object value)
    • signature

      String signature()
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • javaType

      public Class<?> javaType()
      Returns the value of the javaType record component.
      Returns:
      the value of the javaType record component
    • greedy

      public boolean greedy()
      Returns the value of the greedy record component.
      Returns:
      the value of the greedy record component
    • type

      public com.mojang.brigadier.arguments.ArgumentType<?> type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • nativeTypes

      public NativeArgumentTypes nativeTypes()
      Returns the value of the nativeTypes record component.
      Returns:
      the value of the nativeTypes record component