Class BaseMethod

All Implemented Interfaces:
io.github.mmm.code.api.CodeWithContext, io.github.mmm.code.api.copy.CodeNodeItemCopyable<io.github.mmm.code.api.member.CodeMethods, io.github.mmm.code.api.member.CodeMethod>, 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.element.CodeElementWithTypeVariables, io.github.mmm.code.api.item.CodeItem, io.github.mmm.code.api.item.CodeItemWithComment, 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.CodeItemWithVariables, io.github.mmm.code.api.item.CodeMutableItem, io.github.mmm.code.api.item.CodeMutableItemWithComment, io.github.mmm.code.api.member.CodeMember, io.github.mmm.code.api.member.CodeMethod, io.github.mmm.code.api.member.CodeOperation, io.github.mmm.code.api.merge.CodeAdvancedMergeableItem<io.github.mmm.code.api.member.CodeMethod>, io.github.mmm.code.api.merge.CodeMergeableItem<io.github.mmm.code.api.member.CodeMethod>, io.github.mmm.code.api.node.CodeFunction, io.github.mmm.code.api.node.CodeNode, io.github.mmm.code.api.node.CodeNodeItem, io.github.mmm.code.api.object.CodeMutable

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

  • 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 BaseMethods 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.CodeMethods, io.github.mmm.code.api.member.CodeMethod>
      Specified by:
      getParent in interface io.github.mmm.code.api.member.CodeOperation
      Specified by:
      getParent in class BaseOperation
    • doSetImmutable

      protected void doSetImmutable()
      Description copied from class: BaseMutableItem
      Called on the first call of BaseMutableItem.setImmutable(). Has to be overridden to update Collections, make child items immutable, etc.
      Overrides:
      doSetImmutable in class BaseOperation
    • getReturns

      public BaseReturn getReturns()
      Specified by:
      getReturns in interface io.github.mmm.code.api.member.CodeMethod
    • getDefaultValue

      public io.github.mmm.code.api.expression.CodeExpression getDefaultValue()
      Specified by:
      getDefaultValue in interface io.github.mmm.code.api.member.CodeMethod
    • setDefaultValue

      public void setDefaultValue(io.github.mmm.code.api.expression.CodeExpression defaultValue)
      Specified by:
      setDefaultValue in interface io.github.mmm.code.api.member.CodeMethod
    • getReflectiveObject

      public Method getReflectiveObject()
      Specified by:
      getReflectiveObject in interface io.github.mmm.code.api.element.CodeElementWithTypeVariables
      Specified by:
      getReflectiveObject in interface io.github.mmm.code.api.member.CodeMember
      Specified by:
      getReflectiveObject in interface io.github.mmm.code.api.member.CodeMethod
      Specified by:
      getReflectiveObject in interface io.github.mmm.code.api.item.CodeMutableItem
      Specified by:
      getReflectiveObject in interface io.github.mmm.code.api.member.CodeOperation
      Specified by:
      getReflectiveObject in class BaseOperation
    • canHaveBody

      public boolean canHaveBody()
      Specified by:
      canHaveBody in interface io.github.mmm.code.api.node.CodeFunction
      Overrides:
      canHaveBody in class BaseOperation
    • getSourceCodeObject

      public io.github.mmm.code.api.member.CodeMethod getSourceCodeObject()
      Specified by:
      getSourceCodeObject in class BaseOperation
      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.
    • getParentMethod

      public io.github.mmm.code.api.member.CodeMethod getParentMethod()
      Specified by:
      getParentMethod in interface io.github.mmm.code.api.member.CodeMethod
    • getAccessorField

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

      public io.github.mmm.code.api.member.CodeMethod merge(io.github.mmm.code.api.member.CodeMethod 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.CodeMethod>
    • copy

      public BaseMethod 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.element.CodeElementWithTypeVariables
      Specified by:
      copy in interface io.github.mmm.code.api.member.CodeMember
      Specified by:
      copy in interface io.github.mmm.code.api.member.CodeMethod
      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.CodeMethods, io.github.mmm.code.api.member.CodeMethod>
      Specified by:
      copy in interface io.github.mmm.code.api.member.CodeOperation
      Specified by:
      copy in class BaseOperation
    • copy

      public BaseMethod 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.CodeMethods, io.github.mmm.code.api.member.CodeMethod>
    • 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)