Class HintedExpression


  • public class HintedExpression
    extends Expression
    Wraps an expression with a formatting hint.
    Author:
    Holger Eichelberger
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Expression expression  
      private java.lang.String hint  
    • Constructor Summary

      Constructors 
      Constructor Description
      HintedExpression​(Expression expression, java.lang.String hint)
      Creates a hinted expression.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object accept​(IExpressionVisitor visitor)
      Visits the expression.
      java.lang.String getFormattingHint()
      Returns the formatting hint assigned to this expression.
      TypeDescriptor<?> inferType()
      Infers the type of this expression including the type of the contained sub-expressions.
      boolean replaceEmptyLine()
      In content replacement, replace an entire line if this expression is evaluated to an empty string.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • hint

        private java.lang.String hint
    • Constructor Detail

      • HintedExpression

        public HintedExpression​(Expression expression,
                                java.lang.String hint)
        Creates a hinted expression.
        Parameters:
        expression - the expression
        hint - the formatting hint
    • Method Detail

      • 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)
      • replaceEmptyLine

        public boolean replaceEmptyLine()
        Description copied from class: Expression
        In content replacement, replace an entire line if this expression is evaluated to an empty string.
        Overrides:
        replaceEmptyLine in class Expression
        Returns:
        true for replace entire line, false (default) else
      • getFormattingHint

        public java.lang.String getFormattingHint()
        Description copied from class: Expression
        Returns the formatting hint assigned to this expression.
        Overrides:
        getFormattingHint in class Expression
        Returns:
        the formatting hint, null for none