Paul Austin a écrit :
> I would like to extend the Task class to support properties. Properties 
> can be set by plug-ins on the task. An example of a property would be 
> the SRID for the whole task. This will allow us to support extended 
> metadata on tasks without having to add new methods each time or 
> subclassing.
>   
Seems to be a good idea to me.
> I propose to use QName's as the key for the keys for the properties. 
> This would allow different namespaces for different applications.
>
> The change would include the following.
>
> private void Map<QName,Object> properties = new HashMap<QName,Object>();
>
> public void setProperty(QName name, Object value) {
>   properties.put(name, value);
> }
>
> /**
>  * This will auto cast so you can just type things like
> *  int value = getProperty(MY_KEY);
>  */
> public <T> T getProperty(QName name) {
>   return (T)properties.get(name);
> }
>   
Hey, looks like magic code.
I cannot understand how the type T can be used in an object method if it 
has not been declared in the class definition.
Can really the jvm know how to cast properties.get(KEY) while the object 
associated with this key can be any Object value?

Michaël
> public Map<QName,Object> getProperties() {
> }
>
> We'd also need to have it setup so this would be saved to the project file.
>
> Any suggestions/comments?
>
> Paul
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>
>
>   


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to