org.apache.derby.iapi.services.diag
Class DiagnosticUtil

java.lang.Object
  extended byorg.apache.derby.iapi.services.diag.DiagnosticUtil

public class DiagnosticUtil
extends java.lang.Object

The Diagnostic framework is meant to provide a way to include as much diagnostic capability within the distributed release of the cloudscape product without adversely affecting the runtime speed or foot print of a running configuration that needs not use this information. In order to decrease the class size of running objects diagnostic information should be put in "helper" classes. So to provide diagnostic capabiility on the implementation of class Foo.java create a class D_Foo.java. Class D_Foo must implement the Diagnosticable interface. This class provide utility functions to get at the information provided by the D_* helper class: findDiagnostic() - given and object "obj", get an instance of D_obj. toDiagString() - return the "best" diagnostic string available about a given object.


Constructor Summary
private DiagnosticUtil()
           
 
Method Summary
static Diagnosticable findDiagnostic(java.lang.Object ref)
          Given an object return instance of the diagnostic object for this class.
static java.lang.String toDiagString(java.lang.Object obj)
          Return a diagnostic string associated with an object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiagnosticUtil

private DiagnosticUtil()
Method Detail

findDiagnostic

public static Diagnosticable findDiagnostic(java.lang.Object ref)
Given an object return instance of the diagnostic object for this class.

Given an object this routine will determine the classname of the object and then try to instantiate a new instance of the diagnostic object for this class by prepending on "D_" to the last element of theclassname. If no matching class is found then the same lookup is made on the super-class of the object, looking all the way up the hierachy until a diagnostic class is found.
This routine will call "init(ref)" on the new instance and then return the new instance.

Parameters:
ref - The object which to build the diagnostic object for.
Returns:
A new instance of the diagnostic object for input object, or null if one could not be found for some reason.

toDiagString

public static java.lang.String toDiagString(java.lang.Object obj)
Return a diagnostic string associated with an object.

A utility interface to use if you just want to print a single string that represents the object in question. In following order this routine will deliver the string to use: 1) find diagnostic help class, and use class.diag() 2) else just use class.toString()

Parameters:
obj - The object to print out.
Returns:
The string describing the class input.

Built on Tue 2006-10-10 19:23:47+0200, from revision exported

Apache Derby V10.1 Engine Documentation - Copyright © 1997,2005 The Apache Software Foundation or its licensors, as applicable.