com.mortbay.Util
Class DataClass

java.lang.Object
  |
  +--com.mortbay.Util.DataClass

public class DataClass
extends java.lang.Object

Data class Helper. This class provides static utility routines that assist with the creation and output of hierarchies of aggregated classes that contain public data members (what used to be called structures :-).

Version:
1.0 Fri Dec 5 1997
Author:
Greg Wilkins (gregw)

Constructor Summary
DataClass()
           
 
Method Summary
static java.lang.Object emptyInstance(java.lang.Class instance_class)
          Construct and return an "empty" instance of a class.
static java.lang.String toString(java.lang.Object object)
          Formatted object toString.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataClass

public DataClass()
Method Detail

emptyInstance

public static java.lang.Object emptyInstance(java.lang.Class instance_class)
Construct and return an "empty" instance of a class. An empty instance is a class constructed with its simplest constructor and with all its public members non null. The recursive process to create a null instance is as follows:
1. Attempt to construct with null constructor.
2. If construction failed, look for a constructor taking an int and call it with 0. 3. For all public data members:
3a. If the member is a builtin type, leave as is.
3b. If the member is a string, set to the null string. 3c. If the member is an array:
create an empty array
3d. If the member is an object, call emptyInstance to create it.
Parameters:
The - class to construct.
Returns:
An empty instance of the class

toString

public static java.lang.String toString(java.lang.Object object)
Formatted object toString. Presents members in formated string
Parameters:
object -  
Returns: