Stefano - I am impressed with your work so far.
I have recompiled the library with all PdfDataObject references now PdfObject
It seems to work well.
Is that abstraction really needed ?
Also have you considered any better ways of testing objects rather than using instanceof ?
Why do you hate PdfDataObject? ;-)
I'm glad you're experimenting with PDF Clown, but PdfDataObject is not an arbitrary class; let me explain in the following notes.
It's perfectly possible that you could substitute PdfObject for PdfDataObject without compilation problems: actually, PdfDataObject's interface is the same as PdfObject... but in this way you are missing the relevant point: semantics! PdfDataObject is a special PdfObject which models PDF data entities, differently from, say, PdfIndirectObject (another specialization of PdfObject) which serves as an infrastructure entity bearing PdfDataObject instances for reference purposes. If you use PdfObject in place of PdfDataObject you introduce the possibility to assign inappropriate objects (I don't think it's a wise choice...).
If you want to understand the motivations behind the design and implementation of the library, I suggest you to skim through the User Guide included in the current downloadable release.
I obviously know that polymorphism generally must be preferred to the 'instanceof' operator; I extensively used interface abstraction and limited 'instanceof' to particular situations. Please be more specific (show me some code fragments you judge improvable and propose your better solution), thank you.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.