Class TypeDefinitions

java.lang.Object
com.aquima.interactions.expressions.r7.semantics.TypeDefinitions
All Implemented Interfaces:
ITypeDefinitions

public class TypeDefinitions extends Object implements ITypeDefinitions
This class encapsulates an definition source and adds functions and expression templates for usage within the expression parsing process.
Since:
6.0
Author:
F. van der Meer
  • Constructor Details

    • TypeDefinitions

      public TypeDefinitions(IDefinitionSource definitionSource, Map<String,IExpr> expressionTemplates)
      Constructs a type definitions with a definition source, the definition source is mandatory.
      Parameters:
      definitionSource - The definition source which defines the root object definitions.
      expressionTemplates - The map of expression templates available during runtime.
  • Method Details

    • getFunctionDefinitions

      public IFunction[] getFunctionDefinitions(String functionName)
      Description copied from interface: ITypeDefinitions
      This method looks up all function definitions for it's name. Function parameter matching is done by the parser itself.
      Specified by:
      getFunctionDefinitions in interface ITypeDefinitions
      Parameters:
      functionName - The name of the function which should not be null or empty.
      Returns:
      An array of functions, an empty array should be returned when there was no match.
    • getSharedAncestor

      public String getSharedAncestor(String expectedType, String receivedType)
      Description copied from interface: ITypeDefinitions
      This function locates the shared ancestor type for the 2 passed arguments. It will try to find the 'first' shared ancestor within the ancestry tree. If they do not have a shared ancestor null will be returned.
      Specified by:
      getSharedAncestor in interface ITypeDefinitions
      Parameters:
      expectedType - The first type argument.
      receivedType - The second type argument.
      Returns:
      A string representing the shared ancestor, null when they have no common ancestor.
    • lookupRecordType

      public Type lookupRecordType(String entityTypeName, String accessorName)
      Description copied from interface: ITypeDefinitions
      This method looks for the type of record access (field) element.
      Specified by:
      lookupRecordType in interface ITypeDefinitions
      Parameters:
      entityTypeName - The record type name.
      accessorName - The field name within the record.
      Returns:
      The type of this field when found, null otherwise.
    • lookupRecordType

      public Type lookupRecordType(String entityTypeName)
      Description copied from interface: ITypeDefinitions
      This function locates the type object for an entity-type name.
      Specified by:
      lookupRecordType in interface ITypeDefinitions
      Parameters:
      entityTypeName - The type name of the entity which should be non-zero length.
      Returns:
      The type of this entity type when found, null otherwise.
    • lookupVariable

      public Type lookupVariable(String recordTypeName, String instanceName)
      Description copied from interface: ITypeDefinitions
      This function looks up a variable ( named-instance ) from the definitions. In this case the variable is a statically created instance which should be available on runtime at all times.
      Specified by:
      lookupVariable in interface ITypeDefinitions
      Parameters:
      recordTypeName - The type name of the record ( entity-type )
      instanceName - The instance name which is unique for this entity-type.
      Returns:
      The type object for this named instance, null otherwise.
    • getExpressionTemplate

      public IExpr getExpressionTemplate(String templateName)
      Description copied from interface: ITypeDefinitions
      This function returns the expression object corresponding to the template name.
      Specified by:
      getExpressionTemplate in interface ITypeDefinitions
      Parameters:
      templateName - The name of the expression template.
      Returns:
      The parsed expression object corresponding to this template, null when it was not found.