|
PDF Clown 0.1.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.pdfclown.objects.PdfObjectWrapper<TDataObject>
public abstract class PdfObjectWrapper<TDataObject extends PdfDataObject>
High-level representation of a PDF object.
Specialized objects don't inherit directly from their low-level counterparts
(e.g. Contents
extends
PdfStream
, Pages
extends PdfArray
and so on) because there's no plain one-to
one mapping between primitive PDF types and specialized instances: 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
and so on.
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 can navigate through the low-level structure getting the
baseDataObject
backing this object.
Constructor Summary | |
---|---|
protected |
PdfObjectWrapper()
Instantiates an empty wrapper. |
protected |
PdfObjectWrapper(Document context,
TDataObject baseDataObject)
Instantiates a wrapper registering the specified base data object into the specified document context. |
protected |
PdfObjectWrapper(File context,
TDataObject baseDataObject)
Instantiates a wrapper registering the specified base data object into the specified file context. |
protected |
PdfObjectWrapper(PdfDirectObject baseObject)
Instantiates a wrapper from the specified base object. |
Method Summary | |
---|---|
protected void |
checkCompatibility(Object feature)
Checks whether the specified feature is compatible with the document's conformance version . |
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. |
boolean |
equals(Object obj)
|
boolean |
exists()
Gets whether the underlying data object is concrete. |
TDataObject |
getBaseDataObject()
Gets the underlying data object. |
PdfDirectObject |
getBaseObject()
Gets the underlying reference object, if available; otherwise, gets the underlying data object. |
static PdfDirectObject |
getBaseObject(PdfObjectWrapper<?> wrapper)
Gets the PDF object backing the specified wrapper. |
PdfIndirectObject |
getContainer()
Gets the indirect object containing the base object. |
PdfIndirectObject |
getDataContainer()
Gets the indirect object containing the base data object. |
Document |
getDocument()
Gets the document context. |
File |
getFile()
Gets the file context. |
Metadata |
getMetadata()
Gets the metadata associated to this object. |
protected PdfString |
retrieveName()
Retrieves the name possibly associated to this object, walking through the document's name dictionary. |
protected PdfDirectObject |
retrieveNamedBaseObject()
Retrieves the object name, if available; otherwise, behaves like getBaseObject() . |
protected void |
setBaseObject(PdfDirectObject value)
|
void |
setMetadata(Metadata value)
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected PdfObjectWrapper()
protected PdfObjectWrapper(PdfDirectObject baseObject)
baseObject
- PDF object backing this wrapper. MUST be a reference
every time available.protected PdfObjectWrapper(Document context, TDataObject baseDataObject)
context
- Document context into which the specified data object has to be registered.baseDataObject
- PDF data object backing this wrapper.PdfObjectWrapper(File, PdfDataObject)
protected PdfObjectWrapper(File context, TDataObject baseDataObject)
context
- File context into which the specified data object has to be registered.baseDataObject
- PDF data object backing this wrapper.PdfObjectWrapper(Document, PdfDataObject)
Method Detail |
---|
public static PdfDirectObject getBaseObject(PdfObjectWrapper<?> wrapper)
wrapper
- Object to extract the base from.public 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 boolean equals(Object obj)
equals
in class Object
public boolean exists()
public TDataObject getBaseDataObject()
public PdfIndirectObject getContainer()
public PdfIndirectObject getDataContainer()
public Document getDocument()
public File getFile()
public Metadata getMetadata()
null
, if base data object's type isn't suitable (only PdfDictionary
and PdfStream
objects are allowed).public void setMetadata(Metadata value)
UnsupportedOperationException
- If base data object's type isn't suitable (only
PdfDictionary
and PdfStream
objects are allowed).getMetadata()
public PdfDirectObject getBaseObject()
IPdfObjectWrapper
getBaseObject
in interface IPdfObjectWrapper
protected void checkCompatibility(Object feature)
document's conformance version
.
feature
- Entity whose compatibility has to be checked. Supported types:
VersionEnum
Property name
resolvable to an annotated getter method
AnnotatedElement
RuntimeException
- In case of version conflict (see Strict compatibility mode
).protected PdfString retrieveName()
protected PdfDirectObject retrieveNamedBaseObject()
getBaseObject()
.
protected void setBaseObject(PdfDirectObject value)
|
PDF Clown 0.1.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |