net.sf.ivmaidns.util
Class ToString

java.lang.Object
  extended by net.sf.ivmaidns.util.ToString
All Implemented Interfaces:
java.io.Serializable

public class ToString
extends java.lang.Object
implements java.io.Serializable

Class for 'object-to-string' converters. All 'object-to-string' converters should extend this adapter class and override toString(Object), implementing their own conversion rules. The converters may be used in serializable data structures since Serializable interface is implemented.

Version:
2.0
Author:
Ivan Maidanski
See Also:
GComparator, Serialized Form

Field Summary
static ToString INSTANCE
          The default 'to-string' converter providing the standard Java toString() functionality.
 
Constructor Summary
ToString()
          Constructs a new 'to-string' converter.
 
Method Summary
 java.lang.String toString(java.lang.Object obj)
          The body of 'Object-to-String' converter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final ToString INSTANCE
The default 'to-string' converter providing the standard Java toString() functionality. This constant field is initialized with the instantiation of exactly this converter.

Since:
2.0
See Also:
toString(java.lang.Object)
Constructor Detail

ToString

public ToString()
Constructs a new 'to-string' converter. This constructor is made public to allow custom dynamic instantiation of this class.

Since:
1.1
See Also:
INSTANCE
Method Detail

toString

public java.lang.String toString(java.lang.Object obj)
The body of 'Object-to-String' converter. Returns its operand as a string. If the argument is not instance of the expected type then standard Java toString() method for the specified argument is executed (or "null" is returned if argument is null). This method should be overridden in adapter subclasses to implement specific 'to-string' conversion (instead of the standard conversion).

Parameters:
obj - the object to be converted (may be null).
Returns:
the string representation (not null) of the specified object.
Throws:
java.lang.OutOfMemoryError - if there is not enough memory.
See Also:
INSTANCE