You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jspwiki.apache.org by Janne Jalkanen <ja...@iki.fi> on 2009/04/06 16:09:05 UTC

Re: svn commit: r762294 - in /incubator/jspwiki/trunk: src/java/org/apache/wiki/api/ src/java/org/apache/wiki/workflow/ tests/java/org/apache/wiki/workflow/

>From WikiPage

> -    public Object getAttribute( String key );
> +    public Serializable getAttribute( String key );

I'm sort of leaning towards getting rid of these generic methods and having something like

Date getDateAttribute(String key)
Long getLongAttribute(String key)
String getAttribute(String key)

And vice versa

void setAttribute(String key, Date value)

This allows us to make some basic automatic translations (e.g you can
still get a Long attribute as a String, it'll just be the result of
Long.toString()) but most of all, it gets rid of annoying casting
needs and ClassCastExceptions.

> -    public Map getAttributes();
> +    public Map<String,Serializable> getAttributes();

This I am hoping to get rid of soon.  With the very large attributes
we will be seeing, this is just not a feasible API.

/Janne

Re: svn commit: r762294 - in /incubator/jspwiki/trunk: src/java/org/apache/wiki/api/ src/java/org/apache/wiki/workflow/ tests/java/org/apache/wiki/workflow/

Posted by Andrew Jaquith <an...@gmail.com>.
Yup. Whatever works is fine with me. My intent with this particular
set of changes was to get Workflows prepped for persistence. If and
when you make method/signature changes on WikiPage, the refactoring
will be easy.

On Mon, Apr 6, 2009 at 10:09 AM, Janne Jalkanen <ja...@iki.fi> wrote:
> From WikiPage
>
>> -    public Object getAttribute( String key );
>> +    public Serializable getAttribute( String key );
>
> I'm sort of leaning towards getting rid of these generic methods and having something like
>
> Date getDateAttribute(String key)
> Long getLongAttribute(String key)
> String getAttribute(String key)
>
> And vice versa
>
> void setAttribute(String key, Date value)
>
> This allows us to make some basic automatic translations (e.g you can
> still get a Long attribute as a String, it'll just be the result of
> Long.toString()) but most of all, it gets rid of annoying casting
> needs and ClassCastExceptions.
>
>> -    public Map getAttributes();
>> +    public Map<String,Serializable> getAttributes();
>
> This I am hoping to get rid of soon.  With the very large attributes
> we will be seeing, this is just not a feasible API.
>
> /Janne
>