Class Parameter<T>

java.lang.Object
ch.njol.skript.lang.function.Parameter<T>

public final class Parameter<T> extends Object
  • Field Details

    • PARAM_PATTERN

      public static final Pattern PARAM_PATTERN
  • Constructor Details

  • Method Details

    • getType

      public ClassInfo<T> getType()
      Get the Type of this parameter.
      Returns:
      Type of the parameter
    • newInstance

      public static <T> @Nullable Parameter<T> newInstance(String name, ClassInfo<T> type, boolean single, @Nullable String def)
    • parse

      public static @Nullable List<Parameter<?>> parse(String args)
      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

      public String 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

      public @Nullable Expression<? extends T> 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

      public String toString()
      Overrides:
      toString in class Object