Package com.pnfsoftware.jeb.core.output
Class UnitFormatterAdapter
java.lang.Object
com.pnfsoftware.jeb.core.output.UnitFormatterAdapter
- All Implemented Interfaces:
IUnitFormatter
Standard implementation of a unit formatter.
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a formatter with no document presentation.UnitFormatterAdapter(IUnitDocumentPresentation presentation) Create a formatter and add a transient (non-persisted) document presentation to it. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDocumentPresentation(IUnitDocumentPresentation presentation) Add a transient (non-persisted) document presentation to a unit formatter.voidaddPresentation(IUnitDocumentPresentation presentation, boolean persisted) Add a presentation.voidDiscard all presentations not marked aspersisted.getPresentation(int index) Retrieve a presentation.intGet the number of document presentations contained in this formatter.Retrieve a list of all (persisted and transient) document presentations.voidinsertPresentation(int index, IUnitDocumentPresentation presentation, boolean persisted) Insert a presentation at the given index.booleanisPersisted(int index) Determine whether or not a presentation is to be persisted upon serialization.voidremovePresentation(int index) Remove a presentation.
-
Constructor Details
-
UnitFormatterAdapter
public UnitFormatterAdapter()Create a formatter with no document presentation. -
UnitFormatterAdapter
Create a formatter and add a transient (non-persisted) document presentation to it.- Parameters:
presentation- a document
-
-
Method Details
-
addDocumentPresentation
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 useaddPresentation(IUnitDocumentPresentation, boolean)instead.- Parameters:
presentation- a document
-
getPresentationCount
public int getPresentationCount()Description copied from interface:IUnitFormatterGet the number of document presentations contained in this formatter.- Specified by:
getPresentationCountin interfaceIUnitFormatter- Returns:
- the number of presentations
-
getPresentation
Description copied from interface:IUnitFormatterRetrieve a presentation.- Specified by:
getPresentationin interfaceIUnitFormatter- Parameters:
index- presentation index- Returns:
- the presentation or null
-
addPresentation
Description copied from interface:IUnitFormatterAdd 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:
addPresentationin interfaceIUnitFormatter- Parameters:
presentation- the presentationpersisted- true to persist the presentation, false otherwise; if true, the presentation must beserializable
-
insertPresentation
public void insertPresentation(int index, IUnitDocumentPresentation presentation, boolean persisted) Description copied from interface:IUnitFormatterInsert a presentation at the given index. If the presentation already exists in this formatter, this method will silently fail.- Specified by:
insertPresentationin interfaceIUnitFormatter- Parameters:
index- insertion indexpresentation- the presentationpersisted- true to persist the presentation, false otherwise; if true, the presentation must beserializable
-
removePresentation
public void removePresentation(int index) Description copied from interface:IUnitFormatterRemove a presentation.- Specified by:
removePresentationin interfaceIUnitFormatter- Parameters:
index- presentation index
-
isPersisted
public boolean isPersisted(int index) Description copied from interface:IUnitFormatterDetermine whether or not a presentation is to be persisted upon serialization.- Specified by:
isPersistedin interfaceIUnitFormatter- Parameters:
index- presentation index- Returns:
- persistence indicator
-
getPresentations
Description copied from interface:IUnitFormatterRetrieve 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:
getPresentationsin interfaceIUnitFormatter- Returns:
- a list of document presentations, possibly empty
-
discardTransientPresentations
public void discardTransientPresentations()Description copied from interface:IUnitFormatterDiscard all presentations not marked aspersisted.- Specified by:
discardTransientPresentationsin interfaceIUnitFormatter
-