Interface ClassBodyWrapper.Filter

Enclosing class:
ClassBodyWrapper

public static interface ClassBodyWrapper.Filter
A filter implementation can be used to override the default textual output of the various sections of the class. All methods have a default implementation that can be overridden or wrapped.
  • Method Details

    • writePackage

      default void writePackage(StringBuilder sb, String packageName)
      Write the package declaration.
      Parameters:
      sb - StringBuilder to append to.
      packageName - package name to declare
    • writeDefaultImports

      default void writeDefaultImports(StringBuilder sb, List<String> imports)
      Write the default imports. These are the imports provided by the wrapper as opposed to those declared in the source body.

      Each import String does not include the keyword import or the ending semicolon. It might contain the keyword static.

      Parameters:
      sb - StringBuilder to append to.
      imports - list of imports.
    • writeSourceImports

      default void writeSourceImports(StringBuilder sb, List<String> imports)
      Write the import lines included in the source body. Each line is included as written, with import and semicolon.
      Parameters:
      sb - StringBuilder to append to.
      imports - import lines
    • writeClassDeclaration

      default void writeClassDeclaration(StringBuilder sb, String className, String extendedType, List<String> implementedTypes)
      Write the class declaration.
      Parameters:
      sb - StringBuilder to append to.
      className - name of the class.
      extendedType - name of the super class (may be null).
      implementedTypes - list of implemented interfaces.
    • writeSourceBody

      default void writeSourceBody(StringBuilder sb, List<String> body)
      Write the actual source body. Each line is as written, with any import and extends lines removed.
      Parameters:
      sb - StringBuilder to append to.
      body - lines of the source body.
    • writeClassEnding

      default void writeClassEnding(StringBuilder sb)
      Write the class ending (eg. closing brace).
      Parameters:
      sb - StringBuilder to append to.