Interface Literal<T>

All Superinterfaces:
Debuggable, Expression<T>, SyntaxElement
All Known Implementing Classes:
ConvertedLiteral, LiteralList, LiteralString, SimpleLiteral, UnparsedLiteral

public interface Literal<T> extends Expression<T>
A literal, e.g. a number, string or item. Literals are constants which do not depend on the event and can thus e.g. be used in events.
  • Method Details

    • getArray

      T[] getArray()
    • getSingle

      T getSingle()
    • getConvertedExpression

      @Nullable <R> @Nullable Literal<? extends R> getConvertedExpression(Class<R>... to)
      Description copied from interface: Expression
      Tries to convert this expression to the given type. This method can print an error prior to returning null to specify the cause.

      Please note that expressions whose returnType is not Object will not be parsed at all for a certain class if there's no converter from the expression's returnType to the desired class. Thus this method should only be overridden if this expression's returnType is Object.

      The returned expression should delegate this method to the original expression's method to prevent excessive converted expression chains (see also ConvertedExpression).

      Specified by:
      getConvertedExpression in interface Expression<T>
      Parameters:
      to - The desired return type of the returned expression
      Returns:
      Expression with the desired return type or null if the expression can't be converted to the given type. Returns the expression itself if it already returns the desired type.
      See Also:
    • getAll

      T[] getAll()