Class BaseAnnotations

All Implemented Interfaces:
io.github.mmm.code.api.annotation.CodeAnnotations, io.github.mmm.code.api.CodeWithContext, io.github.mmm.code.api.copy.CodeNodeItemCopyable<io.github.mmm.code.api.element.CodeElement, io.github.mmm.code.api.annotation.CodeAnnotations>, io.github.mmm.code.api.item.CodeItem, io.github.mmm.code.api.item.CodeMutableItem, io.github.mmm.code.api.merge.CodeMergeableItem<io.github.mmm.code.api.annotation.CodeAnnotations>, io.github.mmm.code.api.merge.CodeSimpleMergeableItem<io.github.mmm.code.api.annotation.CodeAnnotations>, io.github.mmm.code.api.node.CodeNode, io.github.mmm.code.api.node.CodeNodeContainer<io.github.mmm.code.api.annotation.CodeAnnotation>, io.github.mmm.code.api.node.CodeNodeItem, io.github.mmm.code.api.node.CodeNodeItemContainer<io.github.mmm.code.api.annotation.CodeAnnotation>, io.github.mmm.code.api.node.CodeNodeItemContainerHierarchical<io.github.mmm.code.api.annotation.CodeAnnotation>, io.github.mmm.code.api.object.CodeMutable, Iterable<io.github.mmm.code.api.annotation.CodeAnnotation>

public class BaseAnnotations extends BaseNodeItemContainerHierarchical<io.github.mmm.code.api.annotation.CodeAnnotation> implements io.github.mmm.code.api.annotation.CodeAnnotations
Base implementation of CodeAnnotations.
Since:
1.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)
  • Constructor Details

    • BaseAnnotations

      public BaseAnnotations(BaseElement parent)
      The constructor.
      Parameters:
      parent - the parent.
    • BaseAnnotations

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

    • getParent

      public BaseElement getParent()
      Specified by:
      getParent in interface io.github.mmm.code.api.annotation.CodeAnnotations
      Specified by:
      getParent in interface io.github.mmm.code.api.node.CodeNode
      Specified by:
      getParent in interface io.github.mmm.code.api.node.CodeNodeItemContainer<io.github.mmm.code.api.annotation.CodeAnnotation>
      Specified by:
      getParent in interface io.github.mmm.code.api.copy.CodeNodeItemCopyable<io.github.mmm.code.api.element.CodeElement, io.github.mmm.code.api.annotation.CodeAnnotations>
    • ensureParent

      protected io.github.mmm.code.api.annotation.CodeAnnotation ensureParent(io.github.mmm.code.api.annotation.CodeAnnotation item)
      Overrides:
      ensureParent in class BaseNodeItemContainer<io.github.mmm.code.api.annotation.CodeAnnotation>
      Parameters:
      item - the item to add.
      Returns:
      the item itself or a copy with this container as parent.
    • isSystemImmutable

      protected boolean isSystemImmutable()
      Overrides:
      isSystemImmutable in class BaseNodeItemContainer<io.github.mmm.code.api.annotation.CodeAnnotation>
      Returns:
      true if this is a system internal node item that is considered to be immutable but is technically set to immutable during (lazy) initialization. Otherwise false.
    • 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 BaseNodeItem
    • getDeclared

      public io.github.mmm.code.api.annotation.CodeAnnotation getDeclared(io.github.mmm.code.api.type.CodeType type)
      Specified by:
      getDeclared in interface io.github.mmm.code.api.annotation.CodeAnnotations
    • add

      public io.github.mmm.code.api.annotation.CodeAnnotation add(io.github.mmm.code.api.type.CodeType type)
      Specified by:
      add in interface io.github.mmm.code.api.annotation.CodeAnnotations
    • createAnnoation

      protected BaseAnnotation createAnnoation(io.github.mmm.code.api.type.CodeType type)
      Parameters:
      type - the type of the BaseAnnotation to create.
      Returns:
      the new BaseAnnotation instance.
    • add

      public void add(io.github.mmm.code.api.annotation.CodeAnnotation item)
      Specified by:
      add in interface io.github.mmm.code.api.annotation.CodeAnnotations
      Overrides:
      add in class BaseNodeItemContainer<io.github.mmm.code.api.annotation.CodeAnnotation>
      Parameters:
      item - the item to add.
    • getDeclaredOrAdd

      public io.github.mmm.code.api.annotation.CodeAnnotation getDeclaredOrAdd(io.github.mmm.code.api.type.CodeType type)
      Specified by:
      getDeclaredOrAdd in interface io.github.mmm.code.api.annotation.CodeAnnotations
    • getAll

      public Iterable<? extends io.github.mmm.code.api.annotation.CodeAnnotation> getAll()
      Specified by:
      getAll in interface io.github.mmm.code.api.annotation.CodeAnnotations
      Specified by:
      getAll in interface io.github.mmm.code.api.node.CodeNodeItemContainerHierarchical<io.github.mmm.code.api.annotation.CodeAnnotation>
    • getSourceCodeObject

      public io.github.mmm.code.api.annotation.CodeAnnotations 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.
    • merge

      public io.github.mmm.code.api.annotation.CodeAnnotations merge(io.github.mmm.code.api.annotation.CodeAnnotations other, io.github.mmm.code.api.merge.CodeMergeStrategy strategy)
      Specified by:
      merge in interface io.github.mmm.code.api.merge.CodeSimpleMergeableItem<io.github.mmm.code.api.annotation.CodeAnnotations>
    • copy

      public BaseAnnotations copy()
      Specified by:
      copy in interface io.github.mmm.code.api.annotation.CodeAnnotations
      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<io.github.mmm.code.api.annotation.CodeAnnotation>
      Specified by:
      copy in interface io.github.mmm.code.api.node.CodeNodeItemContainerHierarchical<io.github.mmm.code.api.annotation.CodeAnnotation>
      Specified by:
      copy in interface io.github.mmm.code.api.copy.CodeNodeItemCopyable<io.github.mmm.code.api.element.CodeElement, io.github.mmm.code.api.annotation.CodeAnnotations>
    • copy

      public BaseAnnotations 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.node.CodeNodeItemContainer<io.github.mmm.code.api.annotation.CodeAnnotation>
      Specified by:
      copy in interface io.github.mmm.code.api.copy.CodeNodeItemCopyable<io.github.mmm.code.api.element.CodeElement, io.github.mmm.code.api.annotation.CodeAnnotations>
    • 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)