Hi,

this is not in the 1.0.1 release, so I wasn't aware of it when I looked
at http://jakarta.apache.org/commons/lang/api/

Thanks for pointing out. However, as I need to use a released version
(unfortunately there is no newer release yet), I'll stay with
String.valueOf() which does the job quite nicely.

In the ObjectUtils, clearifying the differences between

String.valueOf(Object obj)
ObjectUtils.toString(Object obj)
ObjectUtils.toString(Object obj, String default)

would be nice. 

        Regards
                Henning


On Tue, 2003-08-05 at 18:38, [EMAIL PROTECTED] wrote:
> Nope.
> 
>  ObjectUtils.toString(Object obj)
> null -> null, else  obj.toString()
> 
>  ObjectUtils.toString(Object obj,String nullValue)
> null -> nullValue, else  obj.toString()
> 
> Stephen
> 
> >  from:    "Henning P. Schmiedehausen" <[EMAIL PROTECTED]>
> > [EMAIL PROTECTED] writes:
> > >ObjectUtils.toString()
> > 
> > What? This might return [EMAIL PROTECTED] in my memory.
> > 
> > I want to call toString() on arbitrary objects and avoid the NPE when I do 
> > <foo>.toString().
> > 
> >     Regards
> >             Henning
> > 
> > 
> > 
> > >Stephen
> > 
> > >>  from:    "Henning P. Schmiedehausen" <[EMAIL PROTECTED]>
> > >> as I was needing a method like this:
> > >> 
> > >> /**
> > >>  * Returns the toString() value of the passed
> > >>  * object. If null is passed, return the String
> > >>  * "null".
> > >>  *
> > >>  * @param obj The object to print out.
> > >>  * @returns A String representation of the passed
> > >>  *          object.
> > >>  */
> > >> public String safeToString(Object obj) {
> > >>     if (obj == null) {
> > >>         return "null";
> > >>     }
> > >>     return obj.toString();
> > >> }
> > >> 
> > >> for the gadzillionth time and we have 
> > >> 
> > >>     public static String identityToString(Object object) {
> > >>         if (object == null) {
> > >>             return null;
> > >>         }
> > >>         return new StringBuffer()
> > >>             .append(object.getClass().getName())
> > >>             .append('@')
> > >>             .append(Integer.toHexString(System.identityHashCode(object)))
> > >>             .toString();
> > >>     }
> > >> 
> > >> in ObjectUtils, wouldn't this safeToString() be a nice addition to the
> > >> ObjectUtils? Or do we already have something like this in the lang
> > >> somewhere?
> > >> 
> > >>  Regards
> > >>          Henning
> > >> -- 
> > >> Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
> > >> [EMAIL PROTECTED]         49 9131 50 654 0   http://www.intermeta.de/
> > >> 
> > >> Java, perl, Solaris, Linux, xSP Consulting, Web Services 
> > >> freelance consultant -- Jakarta Turbine Development  -- hero for hire
> > >> 
> > >> "You are being far too rational for this discussion."  
> > >>        --- Scott Robert Ladd in <[EMAIL PROTECTED]>
> > >> 
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >> For additional commands, e-mail: [EMAIL PROTECTED]
> > >> 
> > 
> > 
> > >---------------------------------------------------------------------
> > >To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > -- 
> > Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
> > [EMAIL PROTECTED]         49 9131 50 654 0   http://www.intermeta.de/
> > 
> > Java, perl, Solaris, Linux, xSP Consulting, Web Services 
> > freelance consultant -- Jakarta Turbine Development  -- hero for hire
> > 
> > "You are being far too rational for this discussion."  
> >        --- Scott Robert Ladd in <[EMAIL PROTECTED]>
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
[EMAIL PROTECTED]        +49 9131 50 654 0   http://www.intermeta.de/

Java, perl, Solaris, Linux, xSP Consulting, Web Services 
freelance consultant -- Jakarta Turbine Development  -- hero for hire

"You are being far too rational for this discussion."  
       --- Scott Robert Ladd in <[EMAIL PROTECTED]>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to