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 TypeMethodDescriptionvoid
addDocumentPresentation
(IUnitDocumentPresentation presentation) Add a transient (non-persisted) document presentation to a unit formatter.void
addPresentation
(IUnitDocumentPresentation presentation, boolean persisted) Add a presentation.void
Discard all presentations not marked aspersisted
.getPresentation
(int index) Retrieve a presentation.int
Get the number of document presentations contained in this formatter.Retrieve a list of all (persisted and transient) document presentations.void
insertPresentation
(int index, IUnitDocumentPresentation presentation, boolean persisted) Insert a presentation at the given index.boolean
isPersisted
(int index) Determine whether or not a presentation is to be persisted upon serialization.void
removePresentation
(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:IUnitFormatter
Get the number of document presentations contained in this formatter.- Specified by:
getPresentationCount
in interfaceIUnitFormatter
- Returns:
- the number of presentations
-
getPresentation
Description copied from interface:IUnitFormatter
Retrieve a presentation.- Specified by:
getPresentation
in interfaceIUnitFormatter
- Parameters:
index
- presentation index- Returns:
- the presentation or null
-
addPresentation
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 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: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 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:IUnitFormatter
Remove a presentation.- Specified by:
removePresentation
in interfaceIUnitFormatter
- 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 interfaceIUnitFormatter
- Parameters:
index
- presentation index- Returns:
- persistence indicator
-
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 interfaceIUnitFormatter
- Returns:
- a list of document presentations, possibly empty
-
discardTransientPresentations
public void discardTransientPresentations()Description copied from interface:IUnitFormatter
Discard all presentations not marked aspersisted
.- Specified by:
discardTransientPresentations
in interfaceIUnitFormatter
-