Class BaseField

All Implemented Interfaces:
io.github.mmm.code.api.CodeWithContext, io.github.mmm.code.api.copy.CodeNodeItemCopyable<io.github.mmm.code.api.member.CodeFields, io.github.mmm.code.api.member.CodeField>, io.github.mmm.code.api.element.CodeElement, io.github.mmm.code.api.element.CodeElementWithDeclaringType, io.github.mmm.code.api.element.CodeElementWithModifiers, io.github.mmm.code.api.element.CodeElementWithName, io.github.mmm.code.api.expression.CodeExpression, io.github.mmm.code.api.expression.CodeVariable, io.github.mmm.code.api.item.CodeItem, io.github.mmm.code.api.item.CodeItemWithComment, io.github.mmm.code.api.item.CodeItemWithDeclaration, io.github.mmm.code.api.item.CodeItemWithDeclaringType, io.github.mmm.code.api.item.CodeItemWithModifiers, io.github.mmm.code.api.item.CodeItemWithName, io.github.mmm.code.api.item.CodeItemWithType, io.github.mmm.code.api.item.CodeMutableItem, io.github.mmm.code.api.item.CodeMutableItemWithComment, io.github.mmm.code.api.item.CodeMutableItemWithType, io.github.mmm.code.api.member.CodeField, io.github.mmm.code.api.member.CodeMember, io.github.mmm.code.api.merge.CodeAdvancedMergeableItem<io.github.mmm.code.api.member.CodeField>, io.github.mmm.code.api.merge.CodeMergeableItem<io.github.mmm.code.api.member.CodeField>, io.github.mmm.code.api.node.CodeNode, io.github.mmm.code.api.node.CodeNodeItem, io.github.mmm.code.api.object.CodeMutable

public class BaseField extends BaseMember implements io.github.mmm.code.api.member.CodeField
Base implementation of CodeField.
Since:
1.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)
  • Constructor Details

    • BaseField

      public BaseField(BaseFields parent, String name)
      The constructor.
      Parameters:
      parent - the parent.
      name - the name.
    • BaseField

      public BaseField(BaseFields parent, Field reflectiveObject)
      The constructor.
      Parameters:
      parent - the parent.
      reflectiveObject - the reflective object. May be null.
    • BaseField

      public BaseField(BaseField template, io.github.mmm.code.api.copy.CodeCopyMapper mapper)
      The copy-constructor.
      Parameters:
      template - the BaseField to copy.
      mapper - the CodeCopyMapper.
  • Method Details

    • doInitialize

      protected void doInitialize()
      Description copied from class: BaseNodeItem
      Called from BaseMutableItem.initialize() on first invocation. May be overridden but never be called from anywhere else.
      Overrides:
      doInitialize in class BaseElement
    • getParent

      public BaseFields getParent()
      Specified by:
      getParent in interface io.github.mmm.code.api.member.CodeMember
      Specified by:
      getParent in interface io.github.mmm.code.api.node.CodeNode
      Specified by:
      getParent in interface io.github.mmm.code.api.copy.CodeNodeItemCopyable<io.github.mmm.code.api.member.CodeFields, io.github.mmm.code.api.member.CodeField>
      Specified by:
      getParent in class BaseMember
    • getType

      public io.github.mmm.code.api.type.CodeGenericType getType()
      Specified by:
      getType in interface io.github.mmm.code.api.item.CodeItemWithType
    • setType

      public void setType(io.github.mmm.code.api.type.CodeGenericType type)
      Specified by:
      setType in interface io.github.mmm.code.api.item.CodeMutableItemWithType
    • getInitializer

      public io.github.mmm.code.api.expression.CodeExpression getInitializer()
      Specified by:
      getInitializer in interface io.github.mmm.code.api.member.CodeField
    • setInitializer

      public void setInitializer(io.github.mmm.code.api.expression.CodeExpression initializer)
      Specified by:
      setInitializer in interface io.github.mmm.code.api.member.CodeField
    • evaluate

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

      public Field getReflectiveObject()
      Specified by:
      getReflectiveObject in interface io.github.mmm.code.api.member.CodeField
      Specified by:
      getReflectiveObject in interface io.github.mmm.code.api.member.CodeMember
      Specified by:
      getReflectiveObject in interface io.github.mmm.code.api.item.CodeMutableItem
      Specified by:
      getReflectiveObject in class BaseMember
    • getSourceCodeObject

      public io.github.mmm.code.api.member.CodeField getSourceCodeObject()
      Specified by:
      getSourceCodeObject in class BaseMember
      Returns:
      the optional internal CodeItem representing the source-code (to merge). Otherwise null. This is an internal API. Do not use or rely on it from outside.
    • merge

      public io.github.mmm.code.api.member.CodeField merge(io.github.mmm.code.api.member.CodeField other, io.github.mmm.code.api.merge.CodeMergeStrategyDecider decider, io.github.mmm.code.api.merge.CodeMergeStrategy parentStrategy)
      Specified by:
      merge in interface io.github.mmm.code.api.merge.CodeAdvancedMergeableItem<io.github.mmm.code.api.member.CodeField>
    • copy

      public BaseField copy()
      Specified by:
      copy in interface io.github.mmm.code.api.element.CodeElement
      Specified by:
      copy in interface io.github.mmm.code.api.element.CodeElementWithDeclaringType
      Specified by:
      copy in interface io.github.mmm.code.api.element.CodeElementWithModifiers
      Specified by:
      copy in interface io.github.mmm.code.api.element.CodeElementWithName
      Specified by:
      copy in interface io.github.mmm.code.api.member.CodeField
      Specified by:
      copy in interface io.github.mmm.code.api.member.CodeMember
      Specified by:
      copy in interface io.github.mmm.code.api.item.CodeMutableItem
      Specified by:
      copy in interface io.github.mmm.code.api.node.CodeNodeItem
      Specified by:
      copy in interface io.github.mmm.code.api.copy.CodeNodeItemCopyable<io.github.mmm.code.api.member.CodeFields, io.github.mmm.code.api.member.CodeField>
      Specified by:
      copy in class BaseMember
    • copy

      public BaseField copy(io.github.mmm.code.api.copy.CodeCopyMapper mapper)
      Specified by:
      copy in interface io.github.mmm.code.api.item.CodeMutableItem
      Specified by:
      copy in interface io.github.mmm.code.api.node.CodeNodeItem
      Specified by:
      copy in interface io.github.mmm.code.api.copy.CodeNodeItemCopyable<io.github.mmm.code.api.member.CodeFields, io.github.mmm.code.api.member.CodeField>
    • getGetter

      public io.github.mmm.code.api.member.CodeMethod getGetter()
      Specified by:
      getGetter in interface io.github.mmm.code.api.member.CodeField
    • getOrCreateGetter

      public io.github.mmm.code.api.member.CodeMethod getOrCreateGetter()
      Specified by:
      getOrCreateGetter in interface io.github.mmm.code.api.member.CodeField
    • getSetter

      public io.github.mmm.code.api.member.CodeMethod getSetter()
      Specified by:
      getSetter in interface io.github.mmm.code.api.member.CodeField
    • getOrCreateSetter

      public io.github.mmm.code.api.member.CodeMethod getOrCreateSetter()
      Specified by:
      getOrCreateSetter in interface io.github.mmm.code.api.member.CodeField
    • 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 BaseElement
      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)