com.triactive.jdo.util
Class Strings

java.lang.Object
  extended bycom.triactive.jdo.util.Strings

public final class Strings
extends java.lang.Object

Contains static methods related to processing strings.

Author:
Mike Martin

Method Summary
static java.lang.String toJvmIdString(java.lang.Object o)
          Converts an object to a simple string representation showing just its type and JVM identity.
static java.lang.String toShortJvmIdString(java.lang.Object o)
          Converts an object to a simple string representation showing just its type (in short form) and JVM identity.
static java.lang.String toStringSafely(java.lang.Object o)
          Used as a "safer" form of Object.toString().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

toJvmIdString

public static java.lang.String toJvmIdString(java.lang.Object o)
Converts an object to a simple string representation showing just its type and JVM identity.

Parameters:
o - The object to be converted to string. Can be null.
Returns:
a string representation of the object

toShortJvmIdString

public static java.lang.String toShortJvmIdString(java.lang.Object o)
Converts an object to a simple string representation showing just its type (in short form) and JVM identity. Same as toJvmIdString(java.lang.Object) except only the last part of the class name is used.

Parameters:
o - The object to be converted to string. Can be null.
Returns:
a string representation of the object

toStringSafely

public static java.lang.String toStringSafely(java.lang.Object o)
Used as a "safer" form of Object.toString(). In this case, "safe" means that we don't use the object's own toString() method unless the object is of a type that we know won't inadvertently generate datastore I/O, directly or indirectly.

An persistent object whose toString() method touches its persistent fields may try to load itself as a result, which in turn may travel back through the same code which was trying to convert the object toString() in the first place, producing an infinite loop. A classic example is throwing an exception whose message includes a toString() of the failed object.

Parameters:
o - The object to be converted to string. Can be null.
Returns:
a string representation of the object


Copyright © 2001-2007 The TJDO Project All Rights Reserved.