Class StringExpression
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.expressions.Expression
-
- net.ssehub.easy.instantiation.core.model.expressions.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 Summary
Fields Modifier and Type Field Description private Expressionexprprivate booleannested
-
Constructor Summary
Constructors Constructor Description StringExpression()Constructor for serialization.StringExpression(Expression expr, boolean nested)Creates a string expression.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectaccept(IExpressionVisitor visitor)Visits the expression.ExpressiongetExpression()Returns the contained expression.TypeDescriptor<?>inferType()Infers the type of this expression including the type of the contained sub-expressions.booleanisNested()Returns whether the expression is nested.-
Methods inherited from class net.ssehub.easy.instantiation.core.model.expressions.Expression
getFormattingHint, replaceEmptyLine
-
-
-
-
Field Detail
-
expr
private Expression expr
-
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:
truefor nested,falseelse
-
inferType
public TypeDescriptor<?> inferType() throws VilException
Description copied from class:ExpressionInfers the type of this expression including the type of the contained sub-expressions.- Specified by:
inferTypein classExpression- 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:ExpressionVisits the expression.- Specified by:
acceptin classExpression- Parameters:
visitor- the visitor- Returns:
- the result of visiting this expression (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
-