public class Inspector
extends Object
The Inspector provides a unified access to an object's information that can be determined by introspection.
| Modifiers | Name | Description |
|---|---|---|
static class |
Inspector.MemberComparator |
Comparator for member information arrays. |
static class |
Inspector.MemberComparatorWithValue |
Comparator for property tuples that include values. |
| Modifiers | Name | Description |
|---|---|---|
static int |
CLASS_CLASS_IDX |
Index for class information. |
static int |
CLASS_INTERFACE_IDX |
Index for implemented interface information. |
static int |
CLASS_OTHER_IDX |
Index for other class information. |
static int |
CLASS_PACKAGE_IDX |
Index for package information. |
static int |
CLASS_SUPERCLASS_IDX |
Index for superclass information. |
static String |
GROOVY |
Origin label for Groovy members. |
static String |
JAVA |
Origin label for Java members. |
static int |
MEMBER_DECLARER_IDX |
Index for member declarer information. |
static int |
MEMBER_EXCEPTIONS_IDX |
Index for member exception information. |
static int |
MEMBER_MODIFIER_IDX |
Index for member modifier information. |
static int |
MEMBER_NAME_IDX |
Index for member name information. |
static int |
MEMBER_ORIGIN_IDX |
Index for member origin information. |
static int |
MEMBER_PARAMS_IDX |
Index for member parameter information. |
static int |
MEMBER_TYPE_IDX |
Index for member type information. |
static int |
MEMBER_VALUE_IDX |
Index for member value information. |
static String |
NOT_APPLICABLE |
Placeholder for unavailable information. |
protected Object |
objectUnderInspection |
Object currently being inspected. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
protected String[] |
fieldInfo(Field field)Builds descriptive information for a Java field. |
|
protected String[] |
fieldInfo(PropertyValue pv)Builds descriptive information for a Groovy property value. |
|
protected Tuple2<Object, String> |
fieldWithInfo(PropertyValue pv)Builds the value and metadata tuple for a Groovy property. |
|
public String[] |
getClassProps()Get the Class Properties of the object under inspection. |
|
protected Class |
getClassUnderInspection()Gets the class of the inspected object. |
|
public Object[] |
getMetaMethods()Get info about instance and class Methods that are dynamically added through Groovy. |
|
public Tuple2[] |
getMetaMethodsWithInfo()Get info about instance and class Methods that are dynamically added through Groovy. |
|
public Object[] |
getMethods()Get info about usual Java instance and class Methods as well as Constructors. |
|
public Tuple2[] |
getMethodsWithInfo()Get info about usual Java instance and class Methods as well as Constructors. |
|
public Object |
getObject()Gets the object being inspected. |
|
public Object[] |
getPropertiesWithInfo()Gets properties together with their values and formatted metadata. |
|
public Object[] |
getPropertyInfo()Get info about Properties (Java and Groovy alike). |
|
public Object[] |
getPublicFields()Get info about usual Java public fields incl. constants. |
|
public boolean |
isGroovy()Indicates whether the inspected type implements GroovyObject. |
|
protected String[] |
methodInfo(Method method)Builds descriptive information for a Java method. |
|
protected String[] |
methodInfo(Constructor ctor)Builds descriptive information for a constructor. |
|
protected String[] |
methodInfo(MetaMethod method)Builds descriptive information for a Groovy meta-method. |
|
public static void |
print(Object[] memberInfo)Prints member information to System.out. |
|
public static String |
shortName(Class clazz)Returns the class name without its package prefix. |
|
public static Collection |
sort(List<Object> memberInfo)Sorts member information using the default comparator. |
|
public static Collection |
sort(List<Object> memberInfo, Comparator<Object> comparator)Sorts member information using the supplied comparator. |
|
protected String[] |
withoutNulls(String[] toNormalize)Replaces null entries with NOT_APPLICABLE. |
Index for class information.
Index for implemented interface information.
Index for other class information.
Index for package information.
Index for superclass information.
Origin label for Groovy members.
Origin label for Java members.
Index for member declarer information.
Index for member exception information.
Index for member modifier information.
Index for member name information.
Index for member origin information.
Index for member parameter information.
Index for member type information.
Index for member value information.
Placeholder for unavailable information.
Object currently being inspected.
objectUnderInspection - must not be nullBuilds descriptive information for a Java field.
field - the field to describeBuilds descriptive information for a Groovy property value.
pv - the property value to describeBuilds the value and metadata tuple for a Groovy property.
pv - the property value to describeGet the Class Properties of the object under inspection.
Gets the class of the inspected object.
Get info about instance and class Methods that are dynamically added through Groovy.
Get info about instance and class Methods that are dynamically added through Groovy.
Get info about usual Java instance and class Methods as well as Constructors.
Get info about usual Java instance and class Methods as well as Constructors.
Gets the object being inspected.
Gets properties together with their values and formatted metadata.
Get info about Properties (Java and Groovy alike).
Get info about usual Java public fields incl. constants.
Indicates whether the inspected type implements GroovyObject.
true if the inspected type is Groovy-awareBuilds descriptive information for a Java method.
method - the method to describeBuilds descriptive information for a constructor.
ctor - the constructor to describeBuilds descriptive information for a Groovy meta-method.
method - the meta-method to describePrints member information to System.out.
memberInfo - the member information to printReturns the class name without its package prefix.
clazz - the class to shortenSorts member information using the default comparator.
memberInfo - the member information to sortSorts member information using the supplied comparator.
memberInfo - the member information to sortcomparator - the comparator to apply Replaces null entries with NOT_APPLICABLE.
toNormalize - the array to normalizeCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.