Re: RFE in org.jpublish.page.Page

Jerome BERNARD <[email protected]> Sat, 20 Sep 2003 00:18:45 +0200
Newsgroups gmane.comp.java.jpublish.devel
Message-ID <[email protected]>
Anthony Eden wrote:

> Both versions 2.x and 3.x include the setProperty() method which you 
> can use to set a property value (but only strings).  Which version of 
> JPublish are you using?

3.0a5.
I do have the setProperty() method and as you said it only works with 
strings.
The thing is I would like to be able to retreive all the properties, and 
as I do not have a way to know why ones are defined this is not 
possible. Either change the properties list to a protected variable, or 
even better, add a method getProperties() that return the list or a 
clone of it.

> Perhaps I can add an attributes map but I am not comfortable making 
> the properties methods backwards incompatible.  Would an attributes 
> map which allows arbitrary objects be sufficient? 

I think there should be some refactoring betweens Page, PageInstance and 
PageDefinition. First of all introducing interfaces would ease things. 
Next, using protected variable would allow extension and customization. 
For example, Page and PageInstance share most of the same methods, etc...

About the potention break of backward compatibility if we changed the 
signature of the method "String getProperty(String name)" to "Object 
getProperty(String name)", I do not think this would be that much a 
disaster: most of the usage must be for inclusion into the context and 
if an object was returned instead of a string, the "toString()" method 
of the object would be called instead which would result in the same 
behaviour if the property value is a String. [I'm not sure I explained 
this point very well :-)]

Regards,
Jérôme.



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf