Class StringExpression


  • public class StringExpression
    extends Expression
    Represents an expression within a string to be used for resolved content statements and strings. Basically, this class represents "$v" or "${v}", which cannot be expressed as constant-variable-constant as the constants would be "quoted" by Strings.
    Author:
    Holger Eichelberger
    • Field Detail

      • nested

        private boolean nested
    • Constructor Detail

      • StringExpression

        StringExpression()
        Constructor for serialization.
      • StringExpression

        public StringExpression​(Expression expr,
                                boolean nested)
        Creates a string expression.
        Parameters:
        expr - the contained expression. Shall not be a constant expression representing a string.
        nested - whether the expression is nested, e.g., in ${x} or plain, e.g. $x
    • Method Detail

      • getExpression

        public Expression getExpression()
        Returns the contained expression.
        Returns:
        the contained expression.
      • isNested

        public boolean isNested()
        Returns whether the expression is nested.
        Returns:
        true for nested, false else
      • inferType

        public TypeDescriptor<?> inferType()
                                    throws VilException
        Description copied from class: Expression
        Infers the type of this expression including the type of the contained sub-expressions.
        Specified by:
        inferType in class Expression
        Returns:
        the type of this expression
        Throws:
        VilException - in case that inferring the type fails
      • accept

        public java.lang.Object accept​(IExpressionVisitor visitor)
                                throws VilException
        Description copied from class: Expression
        Visits the expression.
        Specified by:
        accept in class Expression
        Parameters:
        visitor - the visitor
        Returns:
        the result of visiting this expression (may be null)
        Throws:
        VilException - in case that visiting fails (e.g., execution)