Class StringResolverFactory
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.templateModel.StringResolverFactory
-
- All Implemented Interfaces:
IStringParserFactory<VariableDeclaration>
- Direct Known Subclasses:
StringReplacerFactory
public class StringResolverFactory extends java.lang.Object implements IStringParserFactory<VariableDeclaration>
The default template language string resolver factory. This factory does not create expressions for in-place variable declarations.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description static StringResolverFactoryINSTANCE
-
Constructor Summary
Constructors Modifier Constructor Description protectedStringResolverFactory()Prevents external creation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExpressioncreateForExpression(InPlaceForCommand<VariableDeclaration> cmd)Creates a for-loop expression.ExpressioncreateIfExpression(InPlaceIfCommand<VariableDeclaration> cmd)Creates an alternative expression.ExpressioncreateImportExpression(InPlaceImportCommand<VariableDeclaration> cmd)Creates an import expression.ExpressioncreateVarDeclExpression(InPlaceVarDeclCommand<VariableDeclaration> cmd)Creates a variable declaration expression.VariableDeclarationcreateVariable(java.lang.String name, Expression initExpression, boolean asIterator)Creates a variable.VariableDeclarationcreateVariableDeclaration(java.lang.String name, TypeDescriptor<?> type)Creates a non-constant variable declaration.IVersionRestrictioncreateVersionRestriction(Expression expression, VariableDeclaration variable)Creates a version restriction from the givenexpression.
-
-
-
Field Detail
-
INSTANCE
public static final StringResolverFactory INSTANCE
-
-
Method Detail
-
createIfExpression
public Expression createIfExpression(InPlaceIfCommand<VariableDeclaration> cmd) throws VilException
Description copied from interface:IStringParserFactoryCreates an alternative expression.- Specified by:
createIfExpressionin interfaceIStringParserFactory<VariableDeclaration>- Parameters:
cmd- the command to create an if-expression for- Returns:
- an alternative expression (may be null if not supported)
- Throws:
VilException- if the expression cannot be created
-
createForExpression
public Expression createForExpression(InPlaceForCommand<VariableDeclaration> cmd) throws VilException
Description copied from interface:IStringParserFactoryCreates a for-loop expression.- Specified by:
createForExpressionin interfaceIStringParserFactory<VariableDeclaration>- Parameters:
cmd- the command to create a for-loop expression for- Returns:
- a for-loop expression (may be null if not supported)
- Throws:
VilException- if the expression cannot be created
-
createVariable
public VariableDeclaration createVariable(java.lang.String name, Expression initExpression, boolean asIterator) throws VilException
Description copied from interface:IStringParserFactoryCreates a variable.- Specified by:
createVariablein interfaceIStringParserFactory<VariableDeclaration>- Parameters:
name- the name of the variableinitExpression- the initialization expression determining the type of the iterator variableasIterator- whether the variable shall act as iterator- Returns:
- the variable
- Throws:
VilException- if the variable cannot be created
-
createVariableDeclaration
public VariableDeclaration createVariableDeclaration(java.lang.String name, TypeDescriptor<?> type)
Description copied from interface:IStringParserFactoryCreates a non-constant variable declaration.- Specified by:
createVariableDeclarationin interfaceIStringParserFactory<VariableDeclaration>- Parameters:
name- the name of the variabletype- the type of the variable- Returns:
- the variable declaration
-
createVarDeclExpression
public Expression createVarDeclExpression(InPlaceVarDeclCommand<VariableDeclaration> cmd) throws VilException
Description copied from interface:IStringParserFactoryCreates a variable declaration expression.- Specified by:
createVarDeclExpressionin interfaceIStringParserFactory<VariableDeclaration>- Parameters:
cmd- the command to create a variable declaration expression for- Returns:
- a for-loop expression (may be null if not supported)
- Throws:
VilException- if the expression cannot be created
-
createVersionRestriction
public IVersionRestriction createVersionRestriction(Expression expression, VariableDeclaration variable) throws VilException
Description copied from interface:IStringParserFactoryCreates a version restriction from the givenexpression.- Specified by:
createVersionRestrictionin interfaceIStringParserFactory<VariableDeclaration>- Parameters:
expression- the expressionvariable- the version variable- Returns:
- the version restriction or null if not supported
- Throws:
VilException- if the restriction cannot be created
-
createImportExpression
public Expression createImportExpression(InPlaceImportCommand<VariableDeclaration> cmd) throws VilException
Description copied from interface:IStringParserFactoryCreates an import expression.- Specified by:
createImportExpressionin interfaceIStringParserFactory<VariableDeclaration>- Parameters:
cmd- the command to create an import expression for- Returns:
- a for-loop expression (may be null if not supported)
- Throws:
VilException- if the expression cannot be created
-
-