Class FieldAccessExpression
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.expressions.Expression
-
- net.ssehub.easy.instantiation.core.model.expressions.FieldAccessExpression
-
public class FieldAccessExpression extends Expression
Represents a field access.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private FieldDescriptorfieldprivate booleanmetaAccessprivate FieldAccessExpressionnestedprivate VariableDeclarationvariable
-
Constructor Summary
Constructors Constructor Description FieldAccessExpression()Constructor for serialization.FieldAccessExpression(VariableDeclaration variable, FieldDescriptor field)Creates a field access expression.FieldAccessExpression(FieldAccessExpression nested, FieldDescriptor field)Creates a nested field access expression.FieldAccessExpression(FieldDescriptor field)Creates a static field access expression.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectaccept(IExpressionVisitor visitor)Visits the expression.voidenableMetaAccess()Switches from evaluating the field expression (default) to evaluating the field itself.FieldDescriptorgetField()Returns the field.FieldAccessExpressiongetNested()Returns the nested field access expression.VariableDeclarationgetVariable()Returns the variable to work on.TypeDescriptor<?>inferType()Infers the type of this expression including the type of the contained sub-expressions.booleanisMetaAccess()Returns whether the field itself or the value of the field expression shall be considered during execution.-
Methods inherited from class net.ssehub.easy.instantiation.core.model.expressions.Expression
replaceEmptyLine
-
-
-
-
Field Detail
-
nested
private FieldAccessExpression nested
-
variable
private VariableDeclaration variable
-
field
private FieldDescriptor field
-
metaAccess
private boolean metaAccess
-
-
Constructor Detail
-
FieldAccessExpression
public FieldAccessExpression()
Constructor for serialization.
-
FieldAccessExpression
public FieldAccessExpression(FieldDescriptor field) throws VilException
Creates a static field access expression.- Parameters:
field- the field to access- Throws:
VilException- in case that a static access cannot be done
-
FieldAccessExpression
public FieldAccessExpression(VariableDeclaration variable, FieldDescriptor field) throws VilException
Creates a field access expression.- Parameters:
variable- the variablefield- the field to access- Throws:
VilException- in case that a static access cannot be done
-
FieldAccessExpression
public FieldAccessExpression(FieldAccessExpression nested, FieldDescriptor field)
Creates a nested field access expression.- Parameters:
nested- the nested expression (innermost created by the other constructor)field- the field to access
-
-
Method Detail
-
getNested
public FieldAccessExpression getNested()
Returns the nested field access expression.- Returns:
- the nested expression (null if
getVariable()not null)
-
getVariable
public VariableDeclaration getVariable()
Returns the variable to work on.- Returns:
- the variable (null if
getNested()not null)
-
getField
public FieldDescriptor getField()
Returns the field.- Returns:
- the field
-
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)
-
isMetaAccess
public boolean isMetaAccess()
Returns whether the field itself or the value of the field expression shall be considered during execution.- Returns:
trueif the field itself shall be considered,falseif the evaluation of the field expression shall be considered
-
enableMetaAccess
public void enableMetaAccess()
Switches from evaluating the field expression (default) to evaluating the field itself.
-
-