Class BaseParameter

All Implemented Interfaces:
io.github.mmm.code.api.arg.CodeOperationArg, io.github.mmm.code.api.arg.CodeParameter, io.github.mmm.code.api.CodeWithContext, io.github.mmm.code.api.copy.CodeNodeItemCopyable<io.github.mmm.code.api.arg.CodeParameters, io.github.mmm.code.api.arg.CodeParameter>, io.github.mmm.code.api.element.CodeElement, io.github.mmm.code.api.element.CodeElementWithDeclaringType, 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.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.merge.CodeMergeableItem<io.github.mmm.code.api.arg.CodeParameter>, io.github.mmm.code.api.merge.CodeSimpleMergeableItem<io.github.mmm.code.api.arg.CodeParameter>, io.github.mmm.code.api.node.CodeNode, io.github.mmm.code.api.node.CodeNodeItem, io.github.mmm.code.api.node.CodeNodeItemWithDeclaringOperation, io.github.mmm.code.api.object.CodeMutable

public class BaseParameter extends BaseOperationArg implements io.github.mmm.code.api.arg.CodeParameter
Base implementation of CodeParameter.
Since:
1.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)
  • Constructor Details

    • BaseParameter

      public BaseParameter(BaseParameters parent, String name)
      The constructor.
      Parameters:
      parent - the parent.
      name - the name.
    • BaseParameter

      public BaseParameter(BaseParameters parent, Parameter reflectiveObject)
      The constructor.
      Parameters:
      parent - the parent.
      reflectiveObject - the reflective object. May be null.
    • BaseParameter

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

    • getParent

      public BaseParameters getParent()
      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.arg.CodeParameters, io.github.mmm.code.api.arg.CodeParameter>
    • getDeclaringOperation

      public BaseOperation getDeclaringOperation()
      Specified by:
      getDeclaringOperation in interface io.github.mmm.code.api.node.CodeNodeItemWithDeclaringOperation
      Specified by:
      getDeclaringOperation in class BaseOperationArg
    • getDeclaringType

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

      public String getName()
      Specified by:
      getName in interface io.github.mmm.code.api.item.CodeItemWithName
    • setName

      public void setName(String name)
      Specified by:
      setName in interface io.github.mmm.code.api.element.CodeElementWithName
    • isVarArgs

      public boolean isVarArgs()
      Specified by:
      isVarArgs in interface io.github.mmm.code.api.arg.CodeParameter
    • setVarArgs

      public void setVarArgs(boolean varArgs)
      Specified by:
      setVarArgs in interface io.github.mmm.code.api.arg.CodeParameter
    • getReflectiveObject

      public Parameter getReflectiveObject()
      Specified by:
      getReflectiveObject in interface io.github.mmm.code.api.item.CodeMutableItem
      Specified by:
      getReflectiveObject in interface io.github.mmm.code.api.arg.CodeParameter
      Overrides:
      getReflectiveObject in class BaseMutableItem
    • getReflectiveObjectType

      protected Type getReflectiveObjectType()
      Specified by:
      getReflectiveObjectType in class BaseOperationArg
      Returns:
      the argument Type of the reflective object.
      See Also:
    • getSourceCodeObject

      public io.github.mmm.code.api.arg.CodeParameter getSourceCodeObject()
      Overrides:
      getSourceCodeObject in class BaseElement
      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.
    • evaluate

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

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

      public BaseParameter 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.CodeElementWithName
      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.arg.CodeParameters, io.github.mmm.code.api.arg.CodeParameter>
      Specified by:
      copy in interface io.github.mmm.code.api.arg.CodeParameter
    • copy

      public BaseParameter 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.arg.CodeParameters, io.github.mmm.code.api.arg.CodeParameter>
    • 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 BaseOperationArg
      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)
    • writeReference

      public void writeReference(Appendable sink, boolean declaration, Boolean qualified) throws IOException
      Specified by:
      writeReference in interface io.github.mmm.code.api.item.CodeItemWithDeclaration
      Specified by:
      writeReference in interface io.github.mmm.code.api.expression.CodeVariable
      Throws:
      IOException
    • doWriteDeclaration

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