|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectTranslatableAnalyzer
com.ibm.dtfj.analyzer.base.SimpleAnalyzerBean
com.ibm.dtfj.analyzer.base.CollectionAnalyzerBase
com.ibm.dtfj.analyzer.helpers.objectwrapper.ObjectWrapperCollection
public class ObjectWrapperCollection
Keep track of a collection of one or multiple instances of a given class, and provide utility functions to print the values of various fields directly or indirectly pointed to by each of these instances (using ObjectWrapper to use XPath like syntax to follow a chain of references).
Field Summary | |
---|---|
static int |
INDEX_ALL_EQUAL
Special index value to indicate that, when reading some field out of all the instances contained in this collection, we should verify that the value of the field is identical in every instance (throw an exception if the value are not all identical). |
static int |
INDEX_ALL_INSTANCES
Special index value to indicate that, when printing some field out of all the instances contained in this collection, we should iterate over all instances and print the corresponding field from each instance. |
static int |
INDEX_SINGLETON
Special index value to indicate that the collection should represent a singleton; an exception should be thrown when attempting to access any instances from that collection if there is more than one instance. |
Constructor Summary | |
---|---|
ObjectWrapperCollection()
Null constructor for use as JavaBean |
Method Summary | |
---|---|
java.lang.Object |
get(int index)
Get one particular object instance from the collection represented by this ObjectWrapperCollection. |
int |
getCachingPriority()
Avoid caching ObjectWrapperCollection objects (there are too many of them, and they are cheap to re-create) |
static ObjectWrapperCollection |
getClassDefinitions(IAnalyzerContext context,
java.lang.String className)
Find the ObjectWrapperCollection bean instance with all the definitions of a given class (for access to static class variables). |
static ObjectWrapperCollection |
getObjectInstances(IAnalyzerContext context,
java.lang.String className)
Find the ObjectWrapperCollection bean instance with all the instances of a given class. |
static ObjectWrapperCollection |
getObjectInstancesWithSubClasses(IAnalyzerContext context,
java.lang.String className)
Find the ObjectWrapperCollection bean instance with all the instances of a given class as well as all instances of subclasses of the given class. |
ObjectWrapper |
getObjectWrapper(int index)
Return an ObjectWrapper for a given object instance in the collection. |
ObjectWrapper |
getObjectWrapper(int index,
java.lang.String wrapperName)
Return a wrapper for a given object instance in the collection. |
ObjectWrapper |
getValueAtPath(java.lang.String path,
int index)
Return the object found at the end of a sequence of field references, starting with a given object instance in the collection. |
java.lang.String |
getVersion()
Get version information for this analyser. |
java.util.Iterator |
iterator()
|
void |
printReportAtPath(IAnalysisReport out,
java.lang.String label,
java.lang.String path,
java.lang.String analyzerName,
int index)
Print a report for every object found at the end of a sequence of field references, starting with a given object instance or all instances in the collection. |
void |
printValueAtPath(IAnalysisReport out,
java.lang.String label,
java.lang.String path,
int index)
Print the object or value found at the end of a sequence of field references, starting with a given object instance or all instances in the collection. |
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 underlying this analyzer bean. |
int |
size()
|
Methods inherited from class com.ibm.dtfj.analyzer.base.CollectionAnalyzerBase |
---|
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int INDEX_SINGLETON
public static final int INDEX_ALL_EQUAL
public static final int INDEX_ALL_INSTANCES
Constructor Detail |
---|
public ObjectWrapperCollection()
Method Detail |
---|
public java.lang.String getVersion()
IAnalyzerBase
getVersion
in interface IAnalyzerBase
getVersion
in class SimpleAnalyzerBean
Override the default from SimpleAnalyzerBean ("EXPERIMENTAL").
The version number is typically not defined for small wrappers.
public static ObjectWrapperCollection getObjectInstances(IAnalyzerContext context, java.lang.String className)
context
- the AnalyzerContext in which to locate this bean instanceclassName
- the class name for the instances in this collection
public static ObjectWrapperCollection getObjectInstancesWithSubClasses(IAnalyzerContext context, java.lang.String className)
context
- the AnalyzerContext in which to locate this bean instanceclassName
- the class name for the instances in this collection
public static ObjectWrapperCollection getClassDefinitions(IAnalyzerContext context, java.lang.String className)
context
- the AnalyzerContext in which to locate this bean instanceclassName
- the class name for the class definitions in this collection
public int getCachingPriority()
getCachingPriority
in interface IAnalyzerBase
getCachingPriority
in class SimpleAnalyzerBean
SimpleAnalyzerBean.getCachingPriority()
public void setParent(java.lang.Object parent)
setParent
in interface IWrapper
setParent
in class SimpleAnalyzerBean
parent
- The parent object to set. Must be a string describing the
class name of the objects underlying this collection.IWrapper.setParent(java.lang.Object)
public ObjectWrapper getObjectWrapper(int index) throws com.ibm.dtfj.image.DTFJException, java.lang.IllegalArgumentException
index
- the index of the instance in the collection from which we want to read field, or
one of the special index values for special functions (e.g. INDEX_SINGLETON
, etc.)
com.ibm.dtfj.image.DTFJException
- if the desired instance cannot be found
java.lang.IllegalArgumentException
- if the index
argument is invalidpublic ObjectWrapper getObjectWrapper(int index, java.lang.String wrapperName) throws com.ibm.dtfj.image.DTFJException, java.lang.IllegalArgumentException
index
- the index of the instance in the collection from which we want to read field, or
one of the special index values for special functions (e.g. INDEX_SINGLETON
, etc.)wrapperName
- the name of an analyzer to use as a wrapper for this value (must be a subclass of ObjectWrapper)
com.ibm.dtfj.image.DTFJException
- if the desired instance cannot be found
java.lang.IllegalArgumentException
- if the index
argument is invalidpublic java.lang.Object get(int index) throws java.lang.IllegalStateException, java.lang.IllegalArgumentException
getObjectWrapper(int)
but it parallels the signature of the
method in the List
interface. In particular, it does not throw DTFJException
;
it throws IllegalStateException
instead (a runtime exception).
index
- the index of the instance in the collection from which we want to read field, or
one of the special index values for special functions (e.g. INDEX_SINGLETON
, etc.)
java.lang.IllegalStateException
- if the desired instance cannot be found
java.lang.IllegalArgumentException
- if the index
argument is invalidpublic ObjectWrapper getValueAtPath(java.lang.String path, int index) throws com.ibm.dtfj.image.DTFJException
path
- a path-like string that represents the sequence of field names, separated by "/"index
- the index of the instance in the collection from which we want to read field, or
one of the special index values for special functions (e.g. INDEX_SINGLETON
, etc.)
com.ibm.dtfj.image.DTFJException
- if the index is invalid or the collection contains no instances or the field does not existpublic void printValueAtPath(IAnalysisReport out, java.lang.String label, java.lang.String path, int index)
out
- a AnalysisReport object to which to write the outputlabel
- a name to use for this field in the reportpath
- a path-like string that represents the sequence of field names, separated by "/"index
- the index of the instance in the collection from which we want to read field, or
one of the special index values for special functions (e.g. INDEX_SINGLETON
, etc.)public void printReportAtPath(IAnalysisReport out, java.lang.String label, java.lang.String path, java.lang.String analyzerName, int index)
This method loads a specified analyzer and invokes its produceReport()
method on the target object to generate a new report, which is then embedded in the
main report.
out
- a AnalysisReport object to which to write the outputlabel
- a name to use as title for the report being generatedpath
- a path-like string that represents the sequence of field names, separated by "/"analyzerName
- the name of an analyzer that should generate the report to be printedindex
- the index of the instance in the collection from which we want to read field, or
one of the special index values for special functions (e.g. INDEX_SINGLETON
, etc.)public java.util.Iterator iterator()
iterator
in interface java.lang.Iterable
iterator
in interface java.util.Collection
iterator
in class CollectionAnalyzerBase
Collection.iterator()
public int size()
size
in interface java.util.Collection
size
in class CollectionAnalyzerBase
Collection.size()
public IAnalysisReport produceReport()
IReport
produceReport
in interface IReport
produceReport
in class SimpleAnalyzerBean
IReport.produceReport()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |