Class BaseFieldReference

All Implemented Interfaces:
io.github.mmm.code.api.expression.CodeExpression, io.github.mmm.code.api.expression.CodeFieldReference, io.github.mmm.code.api.expression.CodeMemberReference, io.github.mmm.code.api.item.CodeItem

public class BaseFieldReference extends BaseMemberReference implements io.github.mmm.code.api.expression.CodeFieldReference
Base implementation of CodeFieldReference.
Since:
1.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)
  • Constructor Details

    • BaseFieldReference

      public BaseFieldReference(io.github.mmm.code.api.expression.CodeExpression expression, BaseField field)
      The constructor.
      Parameters:
      expression - the expression.
      field - the referenced field.
    • BaseFieldReference

      public BaseFieldReference(io.github.mmm.code.api.type.CodeGenericType type, BaseField field)
      The constructor.
      Parameters:
      type - the type.
      field - the referenced field.
  • Method Details

    • getMember

      public BaseField getMember()
      Specified by:
      getMember in interface io.github.mmm.code.api.expression.CodeFieldReference
      Specified by:
      getMember in interface io.github.mmm.code.api.expression.CodeMemberReference
      Specified by:
      getMember in class BaseMemberReference
    • evaluate

      public io.github.mmm.code.api.expression.CodeConstant evaluate()
      Specified by:
      evaluate in interface io.github.mmm.code.api.expression.CodeExpression
    • doWrite

      protected void doWrite(Appendable sink, String newline, String defaultIndent, String currentIndent, io.github.mmm.code.api.language.CodeLanguage language) throws IOException
      Overrides:
      doWrite in class BaseMemberReference
      Parameters:
      sink - the Appendable where to append the code from this CodeItem.
      newline - the newline String.
      defaultIndent - the String used for indentation (e.g. a number of spaces to insert per indent level).
      currentIndent - the current indent (number of spaces). Initially the empty string (""). Before a recursion the defaultIndent will be appended.
      language - the CodeLanguage to use.
      Throws:
      IOException - if thrown by Appendable.
      See Also:
      • CodeItem.write(Appendable, String, String)
    • of

      public static BaseFieldReference of(BaseField field)
      Parameters:
      field - the BaseField to reference.
      Returns:
      a new instance of BaseFieldReference for the given BaseField.