+This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+Package
+
+
+
+Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain four categories:
+
Interfaces (italic)
Classes
Enums
Exceptions
Errors
Annotation Types
+
+
+Class/Interface
+
+
+
+Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:
+
Class inheritance diagram
Direct Subclasses
All Known Subinterfaces
All Known Implementing Classes
Class/interface declaration
Class/interface description
+
+
Nested Class Summary
Field Summary
Constructor Summary
Method Summary
+
+
Field Detail
Constructor Detail
Method Detail
+Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
+
+
+Annotation Type
+
+
+
+Each annotation type has its own separate page with the following sections:
+
Annotation Type declaration
Annotation Type description
Required Element Summary
Optional Element Summary
Element Detail
+
+
+
+Enum
+
+
+
+Each enum has its own separate page with the following sections:
+
Enum declaration
Enum description
Enum Constant Summary
Enum Constant Detail
+
+
+Use
+
+Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its Use page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar.
+
+Tree (Class Hierarchy)
+
+There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.
+
When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
+
+
+Deprecated API
+
+The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
+
+Index
+
+The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
+
+Prev/Next
+These links take you to the next or previous class, interface, package, or related page.
+Frames/No Frames
+These links show and hide the HTML frames. All pages are available with or without frames.
+
+
+Serialized Form
+Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
+
Visits an explored value (the whole chain from the root object
+ leading to the value is provided), and decides whether to continue
+ the exploration of that value.
+
Explores an object graph (defined by a root object and whatever is reachable
+ through it, following non-static fields) while using an ObjectVisitor
+ to both control the traversal and return a value.
+
Explores an object graph (defined by a root object and whatever is reachable
+ through it, following non-static fields) while using an ObjectVisitor
+ to both control the traversal and return a value.
+
hasParent()
+
+
+ Returns whether this chain has a parent.
+
+
+
+ boolean
+
isPrimitive()
+
+
+ Returns whether the value of this chain represents a primitive.
+
+
+
+ boolean
+
isThroughArrayIndex()
+
+
+ Returns whether the connection of the parent chain and this chain is
+ through an array index, i.e.
+
+
+
+ boolean
+
isThroughField()
+
+
+ Returns whether the connection of the parent chain and this chain is
+ through a field (of the getParent().getValue().getClass() class).
Returns whether the connection of the parent chain and this chain is
+ through a field (of the getParent().getValue().getClass() class).
+
+
+
+
+
+
+
+
+isThroughArrayIndex
+
+public boolean isThroughArrayIndex()
+
+
Returns whether the connection of the parent chain and this chain is
+ through an array index, i.e. the parent leads to an array, and this chain
+ leads to an element of that array.
+
+
+
+
+
+
+
+
+isPrimitive
+
+public boolean isPrimitive()
+
+
Returns whether the value of this chain represents a primitive.
+
+A utility that can be used to measure the memory footprint of an arbitrary object graph.
+ In a nutshell, the user gives a root object, and this class recursively and
+ reflectively explores the object's references.
+
+
This class can only be used if the containing jar has been given to the
+ Java VM as an agent, as follows: -javaagent:path/to/object-explorer.jar
+
+public static long measureBytes(Object rootObject)
+
+
Measures the memory footprint, in bytes, of an object graph. The object
+ graph is defined by a root object and whatever object can be reached
+ through that, excluding static fields, Class objects, and
+ fields defined in enums (all these are considered shared values,
+ which should not contribute to the cost of any single object graph).
+
+
Equivalent to measureBytes(rootObject, Predicates.alwaysTrue()).
+
+
+
Parameters:
rootObject - the root object that defines the object graph to be measured
+
Returns:
the memory footprint, in bytes, of the object graph
+
+
+
+
+
+measureBytes
+
+public static long measureBytes(Object rootObject,
+ Predicate<Object> objectAcceptor)
+
+
Measures the memory footprint, in bytes, of an object graph. The object
+ graph is defined by a root object and whatever object can be reached
+ through that, excluding static fields, Class objects, and
+ fields defined in enums (all these are considered shared values,
+ which should not contribute to the cost of any single object graph), and
+ any object for which the user-provided predicate returns false.
+
+
+
Parameters:
rootObject - the root object that defines the object graph to be measured
objectAcceptor - a predicate that returns true for objects to
+ be explored (and treated as part of the object graph), or false to
+ forbid the traversal to traverse the given object
+
Returns:
the memory footprint, in bytes, of the object graph
Returns an array containing the constants of this enum type, in
+the order they are declared. This method may be used to iterate
+over the constants as follows:
+
+for (ObjectExplorer.Feature c : ObjectExplorer.Feature.values())
+ System.out.println(c);
+
+
+
+
+
Returns:
an array containing the constants of this enum type, in
+the order they are declared
Returns the enum constant of this type with the specified name.
+The string must match exactly an identifier used to declare an
+enum constant in this type. (Extraneous whitespace characters are
+not permitted.)
+
+
+
Parameters:
name - the name of the enum constant to be returned.
+
+A depth-first object graph explorer. The traversal starts at a root (an Object)
+ and explores any other reachable object (recursively) or primitive value, excluding
+ static fields from the traversal. The traversal is controlled by a user-supplied
+ ObjectVisitor, which decides for each explored path whether to continue
+ exploration of that path, and it can also return a value at the end of the traversal.
+
+
+
+
+
+
+
+
+
+
+
+
+Nested Class Summary
+
+
+
+static class
+
ObjectExplorer.Feature
+
+
+ Enumeration of features that may be optionally requested for an object traversal.
+
+
+
+
+
+
+
+
+
+Method Summary
+
+
+
+static
+
+
+
+<T> T
+
+
+
+
exploreObject(Object rootObject,
+ ObjectVisitor<T> visitor)
+
+
+ Explores an object graph (defined by a root object and whatever is reachable
+ through it, following non-static fields) while using an ObjectVisitor
+ to both control the traversal and return a value.
+
+
+
+static
+
+
+
+<T> T
+
+
+
+
exploreObject(Object rootObject,
+ ObjectVisitor<T> visitor,
+ EnumSet<ObjectExplorer.Feature> features)
+
+
+ Explores an object graph (defined by a root object and whatever is reachable
+ through it, following non-static fields) while using an ObjectVisitor
+ to both control the traversal and return a value.
+public static <T> T exploreObject(Object rootObject,
+ ObjectVisitor<T> visitor)
+
+
Explores an object graph (defined by a root object and whatever is reachable
+ through it, following non-static fields) while using an ObjectVisitor
+ to both control the traversal and return a value.
+
+
Equivalent to exploreObject(rootObject, visitor, EnumSet.noneOf(Feature.class)).
+
+
+
Type Parameters:
T - the type of the value obtained (after the traversal) by the ObjectVisitor
Parameters:
rootObject - an object to be recursively explored
visitor - a visitor that is notified for each explored path and decides whether
+ to continue exploration of that path, and constructs a return value
+ at the end of the exploration
+
Returns:
whatever value is returned by the visitor at the end of the traversal
Explores an object graph (defined by a root object and whatever is reachable
+ through it, following non-static fields) while using an ObjectVisitor
+ to both control the traversal and return a value.
+
+
The features further customizes the exploration behavior. In particular:
+
If ObjectExplorer.Feature.VISIT_NULL is contained in features, the visitor will
+ also be notified about exploration of null values.
+
+ In both cases above, the return value of ObjectVisitor.visit(Chain) is ignored,
+ since neither primitive values or null can be further explored.
+
+
+
Type Parameters:
T - the type of the value obtained (after the traversal) by the ObjectVisitor
Parameters:
rootObject - an object to be recursively explored
visitor - a visitor that is notified for each explored path and decides whether
+ to continue exploration of that path, and constructs a return value
+ at the end of the exploration
features - a set of desired features that the object exploration should have
+
Returns:
whatever value is returned by the visitor at the end of the traversal
ObjectGraphMeasurer.Footprint(int objects,
+ int references,
+ Multiset<Class<?>> primitives)
+
+
+ Constructs a Footprint, by specifying the number of objects, references,
+ and primitives (represented as a Multiset).
+
+
+
+
+
+
+
+
+
+Method Summary
+
+
+
+ int
+
getObjects()
+
+
+ Returns the number of objects of this footprint.
Measures the footprint of the specified object graph.
+ The object graph is defined by a root object and whatever object can be reached
+ through that, excluding static fields, Class objects, and
+ fields defined in enums (all these are considered shared values,
+ which should not contribute to the cost of any single object graph).
+
+
Equivalent to measure(rootObject, Predicates.alwaysTrue()).
+
+
+
Parameters:
rootObject - the root object of the object graph
+
Measures the footprint of the specified object graph.
+ The object graph is defined by a root object and whatever object can be reached
+ through that, excluding static fields, Class objects, and
+ fields defined in enums (all these are considered shared values,
+ which should not contribute to the cost of any single object graph), and
+ any object for which the user-provided predicate returns false.
+
+
+
Parameters:
rootObject - the root object of the object graph
objectAcceptor - a predicate that returns true for objects to
+ be explored (and treated as part of the footprint), or false to
+ forbid the traversal to traverse the given object
+
Returns an array containing the constants of this enum type, in
+the order they are declared. This method may be used to iterate
+over the constants as follows:
+
+for (ObjectVisitor.Traversal c : ObjectVisitor.Traversal.values())
+ System.out.println(c);
+
+
+
+
+
Returns:
an array containing the constants of this enum type, in
+the order they are declared
Returns the enum constant of this type with the specified name.
+The string must match exactly an identifier used to declare an
+enum constant in this type. (Extraneous whitespace characters are
+not permitted.)
+
+
+
Parameters:
name - the name of the enum constant to be returned.
+
visit(Chain chain)
+
+
+ Visits an explored value (the whole chain from the root object
+ leading to the value is provided), and decides whether to continue
+ the exploration of that value.
Visits an explored value (the whole chain from the root object
+ leading to the value is provided), and decides whether to continue
+ the exploration of that value.
+
+
In case the explored value is either primitive or null
+ (e.g., if chain.isPrimitive() || chain.getValue() == null),
+ the return value is meaningless and is ignored.
+
+
+
Parameters:
chain - the chain that leads to the explored value.
+
Returns:
Traversal.EXPLORE to denote that the visited object
+ should be further explored, or ObjectVisitor.Traversal.SKIP to avoid
+ exploring it.
ObjectVisitor.visit(Chain chain)
+
+
+ Visits an explored value (the whole chain from the root object
+ leading to the value is provided), and decides whether to continue
+ the exploration of that value.
ObjectExplorer.exploreObject(Object rootObject,
+ ObjectVisitor<T> visitor,
+ EnumSet<ObjectExplorer.Feature> features)
+
+
+ Explores an object graph (defined by a root object and whatever is reachable
+ through it, following non-static fields) while using an ObjectVisitor
+ to both control the traversal and return a value.
ObjectVisitor.visit(Chain chain)
+
+
+ Visits an explored value (the whole chain from the root object
+ leading to the value is provided), and decides whether to continue
+ the exploration of that value.
ObjectExplorer.exploreObject(Object rootObject,
+ ObjectVisitor<T> visitor)
+
+
+ Explores an object graph (defined by a root object and whatever is reachable
+ through it, following non-static fields) while using an ObjectVisitor
+ to both control the traversal and return a value.
+
+
+
+static
+
+
+
+<T> T
+
+
+
+
ObjectExplorer.exploreObject(Object rootObject,
+ ObjectVisitor<T> visitor,
+ EnumSet<ObjectExplorer.Feature> features)
+
+
+ Explores an object graph (defined by a root object and whatever is reachable
+ through it, following non-static fields) while using an ObjectVisitor
+ to both control the traversal and return a value.