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 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: IdentifierResolver
      Returns the compilation result for the indicated identifier.

      If the given string is a valid identifier the compilation result must contain the source code that can be inserted in the expression's code along with the identifier's Datatype.

      If the string is not a valid identifier the returned compilation result must contain an error message with the code UNDEFINED_IDENTIFIER.

      Specified by:
      compile in interface IdentifierResolver<org.faktorips.codegen.JavaCodeFragment>
      Parameters:
      identifier - The identifier to resolve.
      exprCompiler - specialized ExprCompiler can down casted and used to ask for properties or services that are necessary to be able to resolve an identifier properly
      locale - The locale used for locale dependent messages.