Class SymbolAccessHandler

java.lang.Object
de.monticore.interpreter.util.SymbolAccessHandler

public class SymbolAccessHandler extends Object
Handles access of methods/fields of objects, including static elements.

Class2MC-Symbols are supported directly, for other symbols, this needs to be extended with generator specific modifications.

  • Field Details

    • LOG_NAME

      protected static final String LOG_NAME
  • Constructor Details

    • SymbolAccessHandler

      public SymbolAccessHandler()
  • Method Details

    • getSymbolAccess

      public SymbolAccessHandler.SymbolAccess getSymbolAccess(de.monticore.symboltable.ISymbol exprSourceSym, MIFrameLayoutForBasicSymbols frameLayout, InterpreterDataForBasicSymbols iData)
    • getSymbolAccess

      public SymbolAccessHandler.SymbolAccess getSymbolAccess(de.monticore.symboltable.ISymbol exprSourceSym, MIFrameLayoutForBasicSymbols frameLayout, SymTypeExpression objType, de.monticore.interpreter.calculations.MICalculationValue objCalc)
    • createJavaFieldGetter

      protected de.monticore.interpreter.calculations.MICalculation createJavaFieldGetter(FieldSymbol fieldSymbol, de.monticore.interpreter.calculations.MICalculationValue objCalc)
      creates a getter for a field
      Parameters:
      fieldSymbol - The field to read
      objCalc - the calculation
      Returns:
      a calculation that gets the field-value of that object.
    • createJavaFieldGetterOfStatic

      protected de.monticore.interpreter.calculations.MICalculation createJavaFieldGetterOfStatic(FieldSymbol fieldSymbol)
    • createJavaFieldSetter

      protected Optional<de.monticore.interpreter.setters.MISetter> createJavaFieldSetter(FieldSymbol fieldSymbol, de.monticore.interpreter.calculations.MICalculationValue objCalc)
      creates a setter for a field that is not yet bound to a specific object.
      Parameters:
      fieldSymbol - The field to set a new value to
      Returns:
      a function that, given a calculation that returns a Java object, returns a setter that sets the field-value of that object.
    • createJavaFieldSetterOfStatic

      protected Optional<de.monticore.interpreter.setters.MISetter> createJavaFieldSetterOfStatic(FieldSymbol fieldSymbol)
    • getJavaField

      public Field getJavaField(FieldSymbol fieldSymbol)
      Provides a Field provided a native Java field.
      Parameters:
      fieldSymbol - the symbol of the native Java field
      Returns:
      the corresponding Field
    • getHandleOfSymbol

      public MethodHandle getHandleOfSymbol(MethodSymbol methodSym)
      Provides a MethodHandle provided a native Java method.
      Parameters:
      methodSym - the symbol of the native Java method
      Returns:
      the corresponding MethodHandle