Package ch.njol.skript.lang.function
Class Parameter<T>
java.lang.Object
ch.njol.skript.lang.function.Parameter<T>
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription@Nullable Expression
<? extends T> Get the Expression that will be used to provide the default value of this parameter when the function is called.getName()
Get the name of this parameter.getType()
Get the Type of this parameter.boolean
Get whether this parameter takes one or many values.static <T> @Nullable Parameter
<T> newInstance
(String name, ClassInfo<T> type, boolean single, @Nullable String def) Parses function parameters from a string.toString()
-
Field Details
-
PARAM_PATTERN
-
-
Constructor Details
-
Parameter
public Parameter(String name, ClassInfo<T> type, boolean single, @Nullable @Nullable Expression<? extends T> def)
-
-
Method Details
-
getType
Get the Type of this parameter.- Returns:
- Type of the parameter
-
newInstance
-
parse
Parses function parameters from a string. The string should look something like this:"something: string, something else: number = 12"
- Parameters:
args
- The string to parse.- Returns:
- The parsed parameters
-
getName
Get the name of this parameter.Will be used as name for the local variable that contains value of it inside function.
- Returns:
- Name of this parameter
-
getDefaultExpression
Get the Expression that will be used to provide the default value of this parameter when the function is called.- Returns:
- Expression that will provide default value of this parameter
-
isSingleValue
public boolean isSingleValue()Get whether this parameter takes one or many values.- Returns:
- True if this parameter takes one value, false otherwise
-
toString
-