|
PDF Clown 0.0.8 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectit.stefanochizzolini.clown.objects.PdfObjectWrapper<TDataObject>
public abstract class PdfObjectWrapper<TDataObject extends PdfDataObject>
Base high-level representation of a PDF object. All specialized objects (e.g. Document, Page, Pages, ContentStream...) inherit from it.
Somebody may wonder why I didn't directly make specialized objects inherit from
their low-level counterparts (e.g. Page extends PdfDictionary, ContentStream
extends PdfStream and so on): that could have been much smoother anyway, you argue.
Yeah, I could agree if there was a plain one-to-one mapping between primitive PDF
types and specialized instances, but (you know!) reality is not so polished as
theory: the 'Content' entry of Page dictionaries may be a simple reference to a
PdfStream or a PdfArray of references to PdfStream-s, Pages collections may be
spread across a B-tree instead of a flat PdfArray etc. So: in order to hide all
these annoying inner workings, I chose to adopt a composition pattern instead of
the apparently-reasonable (but actually awkward!) inheritance pattern.
Nonetheless, users are always enabled to navigate through the low-level structure
accessing the getBaseDataObject()
method.
Constructor Summary | |
---|---|
protected |
PdfObjectWrapper(File context,
TDataObject baseDataObject)
|
protected |
PdfObjectWrapper(PdfDirectObject baseObject,
PdfIndirectObject container)
|
Method Summary | |
---|---|
abstract Object |
clone(Document context)
Gets a clone of the object, registered inside the given document context. |
boolean |
delete()
Removes the object from its document context. |
TDataObject |
getBaseDataObject()
Gets the underlying data object. |
PdfDirectObject |
getBaseObject()
Gets the underlying reference object, if available; otherwise, behaves like getBaseDataObject() . |
PdfIndirectObject |
getContainer()
Gets the indirect object containing the base object. |
Document |
getDocument()
Gets the document context. |
File |
getFile()
Gets the file context. |
protected void |
setBaseObject(PdfDirectObject value)
|
void |
setContainer(PdfIndirectObject value)
For internal use only. |
void |
update()
Manually update the underlying indirect object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected PdfObjectWrapper(File context, TDataObject baseDataObject)
protected PdfObjectWrapper(PdfDirectObject baseObject, PdfIndirectObject container)
baseObject
- Base PDF object. MUST be a PdfReference
everytime available.container
- Indirect object containing the base object.Method Detail |
---|
public abstract Object clone(Document context)
context
- Which document the clone has to be registered in.public boolean delete()
The object is no more usable after this method returns.
public TDataObject getBaseDataObject()
public PdfDirectObject getBaseObject()
getBaseDataObject()
.
public PdfIndirectObject getContainer()
It's used for update purposes.
public Document getDocument()
public File getFile()
public void update()
protected void setBaseObject(PdfDirectObject value)
public void setContainer(PdfIndirectObject value)
|
PDF Clown 0.0.8 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |