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.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.skriptlang.skript.common.function.Parameter
Parameter.Modifier -
Constructor Summary
ConstructorsConstructorDescriptionScriptParameter(String name, Class<T> type, Expression<?> defaultValue, Parameter.Modifier... modifiers) ScriptParameter(String name, Class<T> type, Set<Parameter.Modifier> modifiers, @Nullable Expression<?> defaultValue) Creates an instance of aScriptParameterrecord class.ScriptParameter(String name, Class<T> type, Parameter.Modifier... modifiers) -
Method Summary
Modifier and TypeMethodDescription@Nullable Expression<?> Returns the value of thedefaultValuerecord component.final booleanIndicates whether some other object is "equal to" this one.Object[]evaluate(@Nullable Expression<? extends T> argument, org.bukkit.event.Event event) Evaluates the argument, using default values if no argument is passed.final inthashCode()Returns a hash code value for this object.Returns the value of themodifiersrecord component.name()Returns the value of thenamerecord component.static Parameter<?> Parses aScriptParameterfrom a script.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.skriptlang.skript.common.function.Parameter
getModifier, hasModifier, isSingle, single
-
Constructor Details
-
ScriptParameter
-
ScriptParameter
public ScriptParameter(String name, Class<T> type, Expression<?> defaultValue, Parameter.Modifier... modifiers) -
ScriptParameter
public ScriptParameter(String name, Class<T> type, Set<Parameter.Modifier> modifiers, @Nullable @Nullable Expression<?> defaultValue) Creates an instance of aScriptParameterrecord class.- Parameters:
name- the value for thenamerecord componenttype- the value for thetyperecord componentmodifiers- the value for themodifiersrecord componentdefaultValue- the value for thedefaultValuerecord component
-
-
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. -
parse
public static Parameter<?> parse(@NotNull @NotNull String name, @NotNull @NotNull Class<?> type, @Nullable @Nullable String def) Parses aScriptParameterfrom 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
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
name
Returns the value of thenamerecord component. -
type
Returns the value of thetyperecord component. -
modifiers
Returns the value of themodifiersrecord component. -
defaultValue
Returns the value of thedefaultValuerecord component.- Returns:
- the value of the
defaultValuerecord component
-