Class BaseMembers<M extends io.github.mmm.code.api.member.CodeMember>

Type Parameters:
M - type of the contained BaseMembers.
All Implemented Interfaces:
io.github.mmm.code.api.CodeWithContext, io.github.mmm.code.api.item.CodeItem, io.github.mmm.code.api.item.CodeItemWithDeclaringType, io.github.mmm.code.api.item.CodeMutableItem, io.github.mmm.code.api.member.CodeMembers<M>, io.github.mmm.code.api.node.CodeNode, io.github.mmm.code.api.node.CodeNodeContainer<M>, io.github.mmm.code.api.node.CodeNodeItem, io.github.mmm.code.api.node.CodeNodeItemContainer<M>, io.github.mmm.code.api.object.CodeMutable, Iterable<M>
Direct Known Subclasses:
BaseFields, BaseOperations, BaseProperties

public abstract class BaseMembers<M extends io.github.mmm.code.api.member.CodeMember> extends BaseNodeItemContainer<M> implements io.github.mmm.code.api.member.CodeMembers<M>
Base implementation of CodeMembers.
Since:
1.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)
  • Constructor Details

    • BaseMembers

      public BaseMembers(BaseType parent)
      The constructor.
      Parameters:
      parent - the parent.
    • BaseMembers

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

    • getParent

      public BaseType getParent()
      Specified by:
      getParent in interface io.github.mmm.code.api.member.CodeMembers<M extends 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.node.CodeNodeItemContainer<M extends io.github.mmm.code.api.member.CodeMember>
    • rename

      protected void rename(M member, String oldName, String newName, Consumer<String> renamer)
      Overrides:
      rename in class BaseNodeItemContainer<M extends io.github.mmm.code.api.member.CodeMember>
      Parameters:
      member - the child to rename.
      oldName - the old name.
      newName - the new name to be set.
      renamer - the Consumer to actually perform the renaming (that may change the Object.hashCode() of the child).
    • add

      public void add(M member)
      Specified by:
      add in interface io.github.mmm.code.api.member.CodeMembers<M extends io.github.mmm.code.api.member.CodeMember>
      Overrides:
      add in class BaseNodeItemContainer<M extends io.github.mmm.code.api.member.CodeMember>
      Parameters:
      member - the item to add.
    • getDeclaringType

      public BaseType getDeclaringType()
      Specified by:
      getDeclaringType in interface io.github.mmm.code.api.item.CodeItemWithDeclaringType
    • getSourceCodeObject

      public abstract io.github.mmm.code.api.member.CodeMembers<M> getSourceCodeObject()
      Overrides:
      getSourceCodeObject in class BaseMutableItem
      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.
    • copy

      public abstract BaseMembers<M> copy()
      Specified by:
      copy in interface io.github.mmm.code.api.member.CodeMembers<M extends 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.node.CodeNodeItemContainer<M extends io.github.mmm.code.api.member.CodeMember>
    • doWrite

      protected void doWrite(Appendable sink, String newline, String defaultIndent, String currentIndent, io.github.mmm.code.api.language.CodeLanguage language) throws IOException
      Specified by:
      doWrite in class BaseItem
      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)