Record Class ScriptParameter<T>

java.lang.Object
java.lang.Record
org.skriptlang.skript.common.function.ScriptParameter<T>
Type Parameters:
T - The type.
Record Components:
name - The name.
type - The type's class.
modifiers - The modifiers.
defaultValue - The default value, or null if there is no default value.
All Implemented Interfaces:
Parameter<T>

public record ScriptParameter<T>(String name, Class<T> type, Set<Parameter.Modifier> modifiers, @Nullable Expression<?> defaultValue) extends Record implements Parameter<T>
A parameter for a DefaultFunction.
  • Constructor Details

  • Method Details

    • evaluate

      public Object[] evaluate(@Nullable @Nullable Expression<? extends T> argument, org.bukkit.event.Event event)
      Evaluates the argument, using default values if no argument is passed.
      Specified by:
      evaluate in interface Parameter<T>
      Parameters:
      argument - The argument.
      event - The event.
      Returns:
      The evaluated result.
      See Also:
    • parse

      public static Parameter<?> parse(@NotNull @NotNull String name, @NotNull @NotNull Class<?> type, @Nullable @Nullable String def)
      Parses a ScriptParameter from a script.
      Parameters:
      name - The name.
      type - The class of the parameter.
      def - The default value, if present.
      Returns:
      A parsed parameter ScriptParameter, or null if parsing failed.
    • 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.
      Specified by:
      name in interface Parameter<T>
      Returns:
      the value of the name record component
    • type

      public Class<T> type()
      Returns the value of the type record component.
      Specified by:
      type in interface Parameter<T>
      Returns:
      the value of the type record component
    • modifiers

      public Set<Parameter.Modifier> modifiers()
      Returns the value of the modifiers record component.
      Specified by:
      modifiers in interface Parameter<T>
      Returns:
      the value of the modifiers record component
    • defaultValue

      @Nullable public @Nullable Expression<?> defaultValue()
      Returns the value of the defaultValue record component.
      Returns:
      the value of the defaultValue record component