Class UnitFormatterAdapter

java.lang.Object
com.pnfsoftware.jeb.core.output.UnitFormatterAdapter
All Implemented Interfaces:
IUnitFormatter

@Ser public class UnitFormatterAdapter extends Object implements IUnitFormatter
Standard implementation of a unit formatter.
  • Constructor Details

    • UnitFormatterAdapter

      public UnitFormatterAdapter()
      Create a formatter with no document presentation.
    • UnitFormatterAdapter

      public UnitFormatterAdapter(IUnitDocumentPresentation presentation)
      Create a formatter and add a transient (non-persisted) document presentation to it.
      Parameters:
      presentation - a document
  • Method Details

    • addDocumentPresentation

      public void addDocumentPresentation(IUnitDocumentPresentation presentation)
      Add a transient (non-persisted) document presentation to a unit formatter. This method is left for compatibility purpose, and will be deprecated in a subsequent release. Please use addPresentation(IUnitDocumentPresentation, boolean) instead.
      Parameters:
      presentation - a document
    • getPresentationCount

      public int getPresentationCount()
      Description copied from interface: IUnitFormatter
      Get the number of document presentations contained in this formatter.
      Specified by:
      getPresentationCount in interface IUnitFormatter
      Returns:
      the number of presentations
    • getPresentation

      public IUnitDocumentPresentation getPresentation(int index)
      Description copied from interface: IUnitFormatter
      Retrieve a presentation.
      Specified by:
      getPresentation in interface IUnitFormatter
      Parameters:
      index - presentation index
      Returns:
      the presentation or null
    • addPresentation

      public void addPresentation(IUnitDocumentPresentation presentation, boolean persisted)
      Description copied from interface: IUnitFormatter
      Add a presentation. The presentation will be appended to the list of existing presentations. If the presentation already exists in this formatter, this method will silently fail.
      Specified by:
      addPresentation in interface IUnitFormatter
      Parameters:
      presentation - the presentation
      persisted - true to persist the presentation, false otherwise; if true, the presentation must be serializable
    • insertPresentation

      public void insertPresentation(int index, IUnitDocumentPresentation presentation, boolean persisted)
      Description copied from interface: IUnitFormatter
      Insert a presentation at the given index. If the presentation already exists in this formatter, this method will silently fail.
      Specified by:
      insertPresentation in interface IUnitFormatter
      Parameters:
      index - insertion index
      presentation - the presentation
      persisted - true to persist the presentation, false otherwise; if true, the presentation must be serializable
    • removePresentation

      public void removePresentation(int index)
      Description copied from interface: IUnitFormatter
      Remove a presentation.
      Specified by:
      removePresentation in interface IUnitFormatter
      Parameters:
      index - presentation index
    • isPersisted

      public boolean isPersisted(int index)
      Description copied from interface: IUnitFormatter
      Determine whether or not a presentation is to be persisted upon serialization.
      Specified by:
      isPersisted in interface IUnitFormatter
      Parameters:
      index - presentation index
      Returns:
      persistence indicator
    • getPresentations

      public List<IUnitDocumentPresentation> getPresentations()
      Description copied from interface: IUnitFormatter
      Retrieve a list of all (persisted and transient) document presentations. This list is a copy; any attempt to modify it will raise an exception.
      Specified by:
      getPresentations in interface IUnitFormatter
      Returns:
      a list of document presentations, possibly empty
    • discardTransientPresentations

      public void discardTransientPresentations()
      Description copied from interface: IUnitFormatter
      Discard all presentations not marked as persisted.
      Specified by:
      discardTransientPresentations in interface IUnitFormatter