Interface IdentifierResolver<T extends org.faktorips.codegen.CodeFragment>

Type Parameters:
T - a CodeFragment implementation for a specific target language
All Known Implementing Classes:
DefaultIdentifierResolver
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface IdentifierResolver<T extends org.faktorips.codegen.CodeFragment>
Resolves identifiers used in an expression.

Example:

 2 * a + 3
 
In the above example a is an identifier. The compiler needs to know a's Datatype and generate appropriate source code that returns the value of a at runtime. The compiler delegates this task to an identifier resolver.
  • Method Summary

    Modifier and Type
    Method
    Description
    compile(String identifier, ExprCompiler<T> exprCompiler, Locale locale)
    Returns the compilation result for the indicated identifier.
  • Method Details

    • compile

      CompilationResult<T> compile(String identifier, ExprCompiler<T> exprCompiler, Locale locale)
      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.

      Parameters:
      identifier - The identifier to resolve.
      locale - The locale used for locale dependent messages.
      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