Interface CodeInterceptor.Appender<S extends CodeSection,W extends AbstractCodeWriter<W>>

Type Parameters:
S - The type of section to intercept.
W - The type of code writer.
All Superinterfaces:
CodeInterceptor<S,W>
Enclosing interface:
CodeInterceptor<S extends CodeSection,W extends AbstractCodeWriter<W>>

public static interface CodeInterceptor.Appender<S extends CodeSection,W extends AbstractCodeWriter<W>> extends CodeInterceptor<S,W>
A code section interceptor that adds text after the intercepted section.

The previously written text is written before append(AbstractCodeWriter, CodeSection) is called. The previously written text is only included if it's a non-empty string.

  • Method Details

    • write

      default void write(W writer, String previousText, S section)
      Description copied from interface: CodeInterceptor
      Intercepts an AbstractCodeWriter section.
      Specified by:
      write in interface CodeInterceptor<S extends CodeSection,W extends AbstractCodeWriter<W>>
      Parameters:
      writer - Writer used to write content. If no write calls are made, any intercepted text is lost.
      previousText - The previous text that was written. This text needs to be written again in order for it to be kept in the section.
      section - The strongly typed section value.
    • append

      void append(W writer, S section)
      Writes text after previous content in the section.
      Parameters:
      writer - The code writer to write to.
      section - The section being intercepted.