Package org.faktorips.fl
Class DefaultIdentifierResolver
java.lang.Object
org.faktorips.fl.DefaultIdentifierResolver
- All Implemented Interfaces:
IdentifierResolver<org.faktorips.codegen.JavaCodeFragment>
public class DefaultIdentifierResolver
extends Object
implements IdentifierResolver<org.faktorips.codegen.JavaCodeFragment>
A default implementation of
IdentifierResolver that allows to register constant strings
as identifiers together with a JavaCodeFragment and Datatype that are used to
create a CompilationResult if the resolver is requested to compile the identifier.
This implementation generates Java code.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCompilationResult<org.faktorips.codegen.JavaCodeFragment>compile(String identifier, ExprCompiler<org.faktorips.codegen.JavaCodeFragment> exprCompiler, Locale locale) Returns the compilation result for the indicated identifier.voidregister(String identifier, org.faktorips.codegen.JavaCodeFragment fragment, org.faktorips.datatype.Datatype datatype) Register the identifier.
-
Constructor Details
-
DefaultIdentifierResolver
public DefaultIdentifierResolver()Creates a new resolver.
-
-
Method Details
-
register
public void register(String identifier, org.faktorips.codegen.JavaCodeFragment fragment, org.faktorips.datatype.Datatype datatype) Register the identifier. -
compile
public CompilationResult<org.faktorips.codegen.JavaCodeFragment> compile(String identifier, ExprCompiler<org.faktorips.codegen.JavaCodeFragment> exprCompiler, Locale locale) Description copied from interface:IdentifierResolverReturns the compilation result for the indicated identifier.If the given string is a valid identifier the compilation result must contain the
source codethat can be inserted in the expression's code along with the identifier'sDatatype.If the string is not a valid identifier the returned compilation result must contain an error message with the code
UNDEFINED_IDENTIFIER.- Specified by:
compilein interfaceIdentifierResolver<org.faktorips.codegen.JavaCodeFragment>- Parameters:
identifier- The identifier to resolve.exprCompiler- specializedExprCompilercan down casted and used to ask for properties or services that are necessary to be able to resolve an identifier properlylocale- The locale used for locale dependent messages.
-