You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Gary Gregory <gg...@seagullsw.com> on 2003/11/14 19:34:57 UTC

[lang] new ToStringStyle inner class?

Hello,

I find myself using the following pattern which I've placed in a class. I am
wondering if anyone else uses this kind of ToStringStyle and whether or not
it could be added as another ToStringStyle inner class.

/**
 * A ToStringStyle which uses a short class name and no hash code.
 */
public final class ShortPrefixToStringStyle extends ToStringStyle {
    public ShortPrefixToStringStyle() {
        this.setUseShortClassName(true);
        this.setUseIdentityHashCode(false);
    }
}

Gary

Re: [lang] new ToStringStyle inner class?

Posted by Stephen Colebourne <sc...@btopenworld.com>.
+1, although IIRC it should be a singleton with a constant.
Stephen
----- Original Message -----
From: "Gary Gregory" <gg...@seagullsw.com>
To: "'Jakarta Commons Developers List'" <co...@jakarta.apache.org>
Sent: Friday, November 14, 2003 6:34 PM
Subject: [lang] new ToStringStyle inner class?


> Hello,
>
> I find myself using the following pattern which I've placed in a class. I
am
> wondering if anyone else uses this kind of ToStringStyle and whether or
not
> it could be added as another ToStringStyle inner class.
>
> /**
>  * A ToStringStyle which uses a short class name and no hash code.
>  */
> public final class ShortPrefixToStringStyle extends ToStringStyle {
>     public ShortPrefixToStringStyle() {
>         this.setUseShortClassName(true);
>         this.setUseIdentityHashCode(false);
>     }
> }
>
> Gary
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org