Record Class NativeTypeInfo.Method

java.lang.Object
java.lang.Record
com.blamejared.crafttweaker.api.natives.NativeTypeInfo.Method
Record Components:
name - The name of the method that should be exposed. The name has to be the same as the native method's one.
getter - The name of the property that can be used to invoke this method as if it were a ZenCode property, if desired; empty otherwise. E.g., if the method name is getFoo, specifying foo as getter means that the method will also be called when the property foo is accessed in a getter context in a ZenCode script.
setter - The name of the property that can be used to invoke this method as if it were a ZenCode property, if desired; empty otherwise. E.g., if the method name is setFoo, specifying foo as setter means that the method will also be called when the property foo is accessed in a setter context in a ZenCode script.
parameters - The NativeTypeInfo.Parameters accepted by this method.
Enclosing class:
NativeTypeInfo

public static record NativeTypeInfo.Method(String name, String getter, String setter, NativeTypeInfo.Parameter[] parameters) extends Record
Holds information relative to a specific native method that should be exposed to ZenCode.
Since:
9.1.0
  • Constructor Details

    • Method

      public Method(String name, String getter, NativeTypeInfo.Parameter... parameters)
      Constructs an instance holding information relative to a native method that should be exposed to ZenCode.

      The created method has no setter alias.

      Parameters:
      name - The name of the method that should be exposed. The name has to be the same as the native method's one.
      getter - The name of the property that can be used to invoke this method as if it were a ZenCode property, if desired; empty otherwise. E.g., if the method name is getFoo, specifying foo as getter means that the method will also be called when the property foo is accessed in a getter context in a ZenCode script.
      parameters - The NativeTypeInfo.Parameters accepted by this method.
      Since:
      9.1.0
    • Method

      public Method(String name, NativeTypeInfo.Parameter... parameters)
      Constructs an instance holding information relative to a native method that should be exposed to ZenCode.

      The created method has no setter or getter alias.

      Parameters:
      name - The name of the method that should be exposed. The name has to be the same as the native method's one.
      parameters - The NativeTypeInfo.Parameters accepted by this method.
      Since:
      9.1.0
    • Method

      public Method(String name, String getter, String setter, NativeTypeInfo.Parameter... parameters)
      Creates an instance of a Method record class.
      Parameters:
      name - the value for the name record component
      getter - the value for the getter record component
      setter - the value for the setter record component
      parameters - the value for the parameters record component
  • Method Details

    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • getter

      public String getter()
      Returns the value of the getter record component.
      Returns:
      the value of the getter record component
    • setter

      public String setter()
      Returns the value of the setter record component.
      Returns:
      the value of the setter record component
    • parameters

      public NativeTypeInfo.Parameter[] parameters()
      Returns the value of the parameters record component.
      Returns:
      the value of the parameters record component