Class BaseImport

java.lang.Object
io.github.mmm.code.base.item.BaseItem
io.github.mmm.code.base.imports.BaseImport
All Implemented Interfaces:
io.github.mmm.code.api.imports.CodeImport, io.github.mmm.code.api.item.CodeItem, Comparable<BaseImport>

public class BaseImport extends BaseItem implements io.github.mmm.code.api.imports.CodeImport, Comparable<BaseImport>
Base implementation of CodeImport.
Since:
1.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)
  • Constructor Details

    • BaseImport

      public BaseImport(String reference, boolean staticFlag)
      The constructor.
      Parameters:
      reference - the reference to import.
      staticFlag - the static flag.
    • BaseImport

      public BaseImport(String reference, boolean staticFlag, List<io.github.mmm.code.api.imports.CodeImportItem> items)
      The constructor.
      Parameters:
      reference - the reference to import.
      staticFlag - the static flag.
      items - the items.
  • Method Details

    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • compareTo

      public int compareTo(BaseImport other)
      Specified by:
      compareTo in interface Comparable<BaseImport>
    • getReference

      public String getReference()
      Specified by:
      getReference in interface io.github.mmm.code.api.imports.CodeImport
    • isStatic

      public boolean isStatic()
      Specified by:
      isStatic in interface io.github.mmm.code.api.imports.CodeImport
    • getItems

      public List<io.github.mmm.code.api.imports.CodeImportItem> getItems()
      Specified by:
      getItems in interface io.github.mmm.code.api.imports.CodeImport
    • 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)