Interface SourceExpression


public interface SourceExpression
An expression read out of source code, exposed without revealing the parse tree it came from.

This exists because reading a property does not always yield a value. A property may be set from a method call, a constant reference, or a string template, and the property panel has to render something for all of them. Callers previously received a JavaParser node and tested it with instanceof MethodCallExpr, which only works for one language.

  • Method Details

    • asText

      String asText()
      Returns:
      the expression exactly as written in the source
    • isCall

      boolean isCall()
      Returns:
      true if this expression is a method or function call
    • callName

      String callName()
      Returns:
      the name of the called method, or null if this is not a call
    • asConstant

      Optional<Object> asConstant()
      The expression's value, when it is a compile-time constant.
      Returns:
      a String, Number, Boolean or enum name, or empty for anything that has to be evaluated, such as a call or an interpolated string