On May 12, 2009, at 4:10 AM, sdumitriu (SVN) wrote:

> Author: sdumitriu
> Date: 2009-05-12 04:10:28 +0200 (Tue, 12 May 2009)
> New Revision: 19722
>
> Modified:
>   platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/objects/ 
> classes/ListItem.java
> Log:
> [misc] Add a toString method useful for debug
>
> Modified: platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/ 
> objects/classes/ListItem.java
> ===================================================================
> --- platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/ 
> objects/classes/ListItem.java 2009-05-12 02:10:22 UTC (rev 19721)
> +++ platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/ 
> objects/classes/ListItem.java 2009-05-12 02:10:28 UTC (rev 19722)
> @@ -105,4 +105,15 @@
>     {
>         this.parent = parent;
>     }
> +
> +    /**
> +     * {...@inheritdoc}
> +     *
> +     * @see Object#toString()
> +     */
> +    @Override
> +    public String toString()
> +    {
> +        return "[" + getId() + ", " + getValue() + ", " +  
> getParent() + "]";

Actually the practice I have followed is to write:

return "id = [" + getId() + "], value = [" + getValue() + "], parent =  
[" + getParent() + "]"

And it's the calling code that will create the outer "[" and "]" if it  
needs to display other items too.

Thanks
-Vincent
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to