Class Parameter<T>

java.lang.Object
ch.njol.skript.lang.function.Parameter<T>
All Implemented Interfaces:
Parameter<T>

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

    • PARAM_PATTERN

      public static final Pattern PARAM_PATTERN
  • Constructor Details

  • Method Details

    • isOptional

      public boolean isOptional()
      Returns whether this parameter is optional or not.
      Returns:
      Whether this parameter is optional or not.
    • getType

      public ClassInfo<T> getType()
      Returns:
      The type of this parameter as a ClassInfo.
    • newInstance

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

      @Nullable 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

      @Deprecated(forRemoval=true, since="2.13") public String getName()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use name() instead.
    • getDefaultExpression

      @Nullable 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
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toString

      public String toString(boolean debug)
    • name

      @NotNull public @NotNull String name()
      Specified by:
      name in interface Parameter<T>
      Returns:
      The name of this parameter.
    • type

      @NotNull public @NotNull Class<T> type()
      Specified by:
      type in interface Parameter<T>
      Returns:
      The type of this parameter.
    • modifiers

      @NotNull public @Unmodifiable @NotNull Set<Parameter.Modifier> modifiers()
      Specified by:
      modifiers in interface Parameter<T>
      Returns:
      All modifiers belonging to this parameter.