com.ibm.dtfj.analyzer.helpers
Class OneJavaObject

java.lang.Object
  extended by TranslatableAnalyzer
      extended by com.ibm.dtfj.analyzer.base.SimpleAnalyzerBean
          extended by com.ibm.dtfj.analyzer.helpers.OneJavaObject
All Implemented Interfaces:
IAnalyzerBase, IReport, IWrapper
Direct Known Subclasses:
OneJavaObject

public class OneJavaObject
extends SimpleAnalyzerBean

Print and extract basic information about one DTFJ JavaObject
List all the fields, list all the object references, lookup a given field.


Constructor Summary
OneJavaObject()
          Null constructor for use as JavaBean
 
Method Summary
 int getCachingPriority()
          Avoid caching OneJavaObject objects (there are too many of them, and they are cheap to re-create)
 ValueWrapper getFieldValue(java.lang.String name, boolean includeSuperclasses)
          Return the value of a given field in this object instance, as an arbitrary Object type encapsulated in a ValueWrapper.
 ValueWrapper getFieldValue(java.lang.String name, java.lang.String className)
          Return the value of a given field in this object instance from a given class in the hierarchy, as an arbitrary Object type encapsulated in a ValueWrapper.
static OneJavaObject getInstance(IAnalyzerContext context, com.ibm.dtfj.java.JavaObject parent)
          Find the OneJavaObject bean instance associated with a given parent JavaObject (create it if necessary)
 com.ibm.dtfj.java.JavaObject getJavaObject()
           
 OneJavaClass getOneJavaClass()
           
 com.ibm.dtfj.java.JavaObject[] getReferences(boolean includeSuperclasses)
          Find all the object references from this object.
 java.lang.String getTypeSignature()
          Get the canonical type signature for this object.
 boolean isNull()
          Check if a given JavaObject represents a null object instance (some null object instances may be represented by a dummy JavaObject XXX This might be changed in a future API revision)
static boolean isNull(com.ibm.dtfj.java.JavaObject obj)
          Check if a given JavaObject represents a null object instance (some null object instances may be represented by a dummy JavaObject XXX This might be changed in a future API revision) Static method to avoid the overhead of allocating an object
protected  void printBasic(IAnalysisReport out)
          Print the basic information related to this JavaObject as a segment of a report (whatever is not included in the extended description shown by printDesc())
 void printFields(IAnalysisReport out, boolean includeSuperclasses)
          Print all the fields defined in this JavaObject and their value, as a segment of a report
 IAnalysisReport produceReport()
          Generate a report which will be encapsulated in the IAnalysisReport object for later use by some formatter.
 void setParent(java.lang.Object parent)
          Set the parent JavaObject underlying this analyzer bean.
 
Methods inherited from class com.ibm.dtfj.analyzer.base.SimpleAnalyzerBean
allocateReport, allocateReportOptions, allocateSecondaryReport, getCategories, getContext, getIdentityString, getInstance, getLogger, getLongDescription, getName, getNextValidObject, getParent, getReportExtensionHelper, getResourceBundleName, getShortDescription, getVersion, isPrimaryAnalyzer, printEmbeddedReport, printEmbeddedReport, printEmbeddedReportWithOptions, printEmbeddedReportWithOptions, printReportInfoHeader, recordInternalExceptionStatic, setContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OneJavaObject

public OneJavaObject()
Null constructor for use as JavaBean

Method Detail

getInstance

public static OneJavaObject getInstance(IAnalyzerContext context,
                                        com.ibm.dtfj.java.JavaObject parent)
Find the OneJavaObject bean instance associated with a given parent JavaObject (create it if necessary)

Parameters:
context - the AnalyzerContext in which to locate this bean instance
parent - the parent JavaObject underlying this analyzer bean
Returns:
the desired OneJavaObject analyzer bean

setParent

public void setParent(java.lang.Object parent)
Set the parent JavaObject underlying this analyzer bean.

Specified by:
setParent in interface IWrapper
Overrides:
setParent in class SimpleAnalyzerBean
Parameters:
parent - The parent object to set. Must be of type JavaObject. compatible with the type of analyzer bean that receives it
See Also:
IWrapper.setParent(java.lang.Object)

getCachingPriority

public int getCachingPriority()
Avoid caching OneJavaObject objects (there are too many of them, and they are cheap to re-create)

Specified by:
getCachingPriority in interface IAnalyzerBase
Overrides:
getCachingPriority in class SimpleAnalyzerBean
Returns:
the caching priority, as a number between 0 and 10
See Also:
SimpleAnalyzerBean.getCachingPriority()

getJavaObject

public com.ibm.dtfj.java.JavaObject getJavaObject()
Returns:
the parent JavaObject underlying this analyzer bean

isNull

public static boolean isNull(com.ibm.dtfj.java.JavaObject obj)
Check if a given JavaObject represents a null object instance (some null object instances may be represented by a dummy JavaObject XXX This might be changed in a future API revision) Static method to avoid the overhead of allocating an object

Parameters:
obj - the JavaObject to check
Returns:
true if this is actually a null instance, false otherwise

isNull

public boolean isNull()
Check if a given JavaObject represents a null object instance (some null object instances may be represented by a dummy JavaObject XXX This might be changed in a future API revision)

Returns:
true if this is actually a null instance, false otherwise

getOneJavaClass

public OneJavaClass getOneJavaClass()
                             throws com.ibm.dtfj.image.DTFJException
Returns:
the OneJavaClass bean representing the class of this JavaObject
Throws:
com.ibm.dtfj.image.DTFJException

getFieldValue

public ValueWrapper getFieldValue(java.lang.String name,
                                  boolean includeSuperclasses)
                           throws com.ibm.dtfj.image.DTFJException
Return the value of a given field in this object instance, as an arbitrary Object type encapsulated in a ValueWrapper.

Parameters:
name - the field name that we are looking for
includeSuperclasses - if true look for fields in this class and all its superclasses; if false, only look for fields declared in this class itself.
Returns:
the value of the field, as a ValueWrapper
Throws:
com.ibm.dtfj.image.DTFJException - if the field is not found

getFieldValue

public ValueWrapper getFieldValue(java.lang.String name,
                                  java.lang.String className)
                           throws com.ibm.dtfj.image.DTFJException
Return the value of a given field in this object instance from a given class in the hierarchy, as an arbitrary Object type encapsulated in a ValueWrapper. This method makes it possible to read fields that are being overriden by subclasses.

Parameters:
name - the field name that we are looking for
className - the name of the class (which must be a superclass of this object's class from which we want to read the field
Returns:
the value of the field, as a ValueWrapper
Throws:
com.ibm.dtfj.image.DTFJException - if the field is not found

getReferences

public com.ibm.dtfj.java.JavaObject[] getReferences(boolean includeSuperclasses)
                                             throws com.ibm.dtfj.image.DTFJException
Find all the object references from this object.

Parameters:
includeSuperclasses - if true look for fields in this class and all its superclasses; if false, only look for fields declared in this class itself.
Returns:
an array of JavaObjects, representing all the desired object references
Throws:
com.ibm.dtfj.image.DTFJException

getTypeSignature

public java.lang.String getTypeSignature()
                                  throws com.ibm.dtfj.image.DTFJException
Get the canonical type signature for this object.

Returns:
the type signature, as a string
Throws:
com.ibm.dtfj.image.DTFJException

produceReport

public IAnalysisReport produceReport()
Description copied from interface: IReport
Generate a report which will be encapsulated in the IAnalysisReport object for later use by some formatter.

Specified by:
produceReport in interface IReport
Overrides:
produceReport in class SimpleAnalyzerBean
Returns:
- the generic report object which will be given to some formatter
See Also:
IReport.produceReport()

printBasic

protected void printBasic(IAnalysisReport out)
Print the basic information related to this JavaObject as a segment of a report (whatever is not included in the extended description shown by printDesc())

Parameters:
out - a AnalysisReport object to which to write the output

printFields

public void printFields(IAnalysisReport out,
                        boolean includeSuperclasses)
Print all the fields defined in this JavaObject and their value, as a segment of a report

Parameters:
out - a AnalysisReport object to which to write the output
includeSuperclasses - true if should recurse and print all the fields from the super class, and so on


© Copyright IBM Corp. 2007, 2008 All Rights Reserved. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.