Class InstantiateExpression
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.expressions.Expression
-
- net.ssehub.easy.instantiation.core.model.expressions.AbstractCallExpression
-
- net.ssehub.easy.instantiation.core.model.common.ModelCallExpression<VariableDeclaration,Script,Rule>
-
- net.ssehub.easy.instantiation.core.model.buildlangModel.InstantiateExpression
-
- All Implemented Interfaces:
IArgumentProvider
public class InstantiateExpression extends ModelCallExpression<VariableDeclaration,Script,Rule>
Represents an instantiate expression. However, an instantiate expression can only be resolved at runtime.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private VariableDeclarationprojectprivate IVersionRestrictionrestriction-
Fields inherited from class net.ssehub.easy.instantiation.core.model.common.ModelCallExpression
resolved
-
-
Constructor Summary
Constructors Constructor Description InstantiateExpression(java.lang.String name, CallArgument... arguments)Creates an instantiate expression.InstantiateExpression(VariableDeclaration project, IVersionRestriction restriction, java.lang.String name, CallArgument... arguments)Creates an instantiate expression.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectaccept(IExpressionVisitor visitor)Visits the expression.protected java.lang.Class<? extends Rule>getOperationClass()Returns the actual operation class, i.e., the class of the operation.VariableDeclarationgetProject()Returns the project variable.IVersionRestrictiongetVersionRestriction()Returns the version restriction.TypeDescriptor<?>inferType()Infers the type of this expression including the type of the contained sub-expressions.booleanisVisible(Script fromModel)Returns whether the resolved model operation is visible.-
Methods inherited from class net.ssehub.easy.instantiation.core.model.common.ModelCallExpression
getArgument, getArgumentsCount, getInvalidOperationMessage, getModel, getResolved, getVilSignature, isPlaceholder, isSuper
-
Methods inherited from class net.ssehub.easy.instantiation.core.model.expressions.AbstractCallExpression
dynamicDispatch, getName, getParameterType, getPrefix, getQualifiedName, getSignature, getVilSignature, isIteratingCollectionOperation, isOclCompliant, isPlaceholder, resolveOperation, resolveOperation, resolveResolvableOperation
-
Methods inherited from class net.ssehub.easy.instantiation.core.model.expressions.Expression
getFormattingHint, replaceEmptyLine
-
-
-
-
Field Detail
-
restriction
private IVersionRestriction restriction
-
project
private VariableDeclaration project
-
-
Constructor Detail
-
InstantiateExpression
public InstantiateExpression(VariableDeclaration project, IVersionRestriction restriction, java.lang.String name, CallArgument... arguments) throws VilException
Creates an instantiate expression.- Parameters:
project- the project variablerestriction- optional version restrictions (may be null)name- the optional name of the rule to be executed (may be null and points then to the main rule)arguments- the rule call arguments- Throws:
VilException- in case that the expression cannot be resolved
-
InstantiateExpression
public InstantiateExpression(java.lang.String name, CallArgument... arguments) throws VilExceptionCreates an instantiate expression.- Parameters:
name- the (qualified) name of the rule to be calledarguments- the rule call arguments- Throws:
VilException- in case that the expression cannot be resolved
-
-
Method Detail
-
getProject
public VariableDeclaration getProject()
Returns the project variable.- Returns:
- the project variable (may be null if a name-based call is given)
-
getVersionRestriction
public IVersionRestriction getVersionRestriction()
Returns the version restriction.- Returns:
- the version restriction (may be null if absent)
-
getOperationClass
protected java.lang.Class<? extends Rule> getOperationClass()
Description copied from class:ModelCallExpressionReturns the actual operation class, i.e., the class of the operation.- Specified by:
getOperationClassin classModelCallExpression<VariableDeclaration,Script,Rule>- Returns:
- the operation class
-
inferType
public TypeDescriptor<?> inferType() throws VilException
Description copied from class:ExpressionInfers the type of this expression including the type of the contained sub-expressions.- Overrides:
inferTypein classModelCallExpression<VariableDeclaration,Script,Rule>- 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)
-
isVisible
public boolean isVisible(Script fromModel)
Description copied from class:ModelCallExpressionReturns whether the resolved model operation is visible.- Specified by:
isVisiblein classModelCallExpression<VariableDeclaration,Script,Rule>- Parameters:
fromModel- the model issuing the call- Returns:
trueif the operation is visible,falseelse
-
-