Inspector (Groovy 4.0.15)
Description: declaration: package: groovy.inspect, class: Inspector

Package groovy.inspect

# Class Inspector

java.lang.Object
groovy.inspect.Inspector

public class Inspector extends Object
The Inspector provides a unified access to an object's information that can be determined by introspection.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `Inspector.MemberComparator`
  `static class`
  `Inspector.MemberComparatorWithValue`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `CLASS_CLASS_IDX`
  `static final int`
  `CLASS_INTERFACE_IDX`
  `static final int`
  `CLASS_OTHER_IDX`
  `static final int`
  `CLASS_PACKAGE_IDX`
  `static final int`
  `CLASS_SUPERCLASS_IDX`
  `static final String`
  `GROOVY`
  `static final String`
  `JAVA`
  `static final int`
  `MEMBER_DECLARER_IDX`
  `static final int`
  `MEMBER_EXCEPTIONS_IDX`
  `static final int`
  `MEMBER_MODIFIER_IDX`
  `static final int`
  `MEMBER_NAME_IDX`
  `static final int`
  `MEMBER_ORIGIN_IDX`
  `static final int`
  `MEMBER_PARAMS_IDX`
  `static final int`
  `MEMBER_TYPE_IDX`
  `static final int`
  `MEMBER_VALUE_IDX`
  `static final String`
  `NOT_APPLICABLE`
  `protected Object`
  `objectUnderInspection`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Inspector(Object objectUnderInspection)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected String[]`
  `fieldInfo(PropertyValue pv)`
  `protected String[]`
  `fieldInfo(Field field)`
  `protected Tuple2<Object,String[]>`
  `fieldWithInfo(PropertyValue pv)`
  `String[]`
  `getClassProps()`
  Get the Class Properties of the object under inspection.
  `protected Class`
  `getClassUnderInspection()`
  `Object[]`
  `getMetaMethods()`
  Get info about instance and class Methods that are dynamically added through Groovy.
  `Tuple2[]`
  `getMetaMethodsWithInfo()`
  Get info about instance and class Methods that are dynamically added through Groovy.
  `Object[]`
  `getMethods()`
  Get info about usual Java instance and class Methods as well as Constructors.
  `Tuple2[]`
  `getMethodsWithInfo()`
  Get info about usual Java instance and class Methods as well as Constructors.
  `Object`
  `getObject()`
  Gets the object being inspected.
  `Object[]`
  `getPropertiesWithInfo()`
  `Object[]`
  `getPropertyInfo()`
  Get info about Properties (Java and Groovy alike).
  `Object[]`
  `getPublicFields()`
  Get info about usual Java public fields incl.
  `boolean`
  `isGroovy()`
  `protected String[]`
  `methodInfo(MetaMethod method)`
  `protected String[]`
  `methodInfo(Constructor ctor)`
  `protected String[]`
  `methodInfo(Method method)`
  `static void`
  `print(Object[] memberInfo)`
  `static String`
  `shortName(Class clazz)`
  `static Collection`
  `sort(List<Object> memberInfo)`
  `static Collection`
  `sort(List<Object> memberInfo, Comparator<Object> comparator)`
  `protected String[]`
  `withoutNulls(String[] toNormalize)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### objectUnderInspection

    protected Object objectUnderInspection

  - ### CLASS_PACKAGE_IDX

    public static final int CLASS_PACKAGE_IDX
    See Also:
      - Constant Field Values

  - ### CLASS_CLASS_IDX

    public static final int CLASS_CLASS_IDX
    See Also:
      - Constant Field Values

  - ### CLASS_INTERFACE_IDX

    public static final int CLASS_INTERFACE_IDX
    See Also:
      - Constant Field Values

  - ### CLASS_SUPERCLASS_IDX

    public static final int CLASS_SUPERCLASS_IDX
    See Also:
      - Constant Field Values

  - ### CLASS_OTHER_IDX

    public static final int CLASS_OTHER_IDX
    See Also:
      - Constant Field Values

  - ### MEMBER_ORIGIN_IDX

    public static final int MEMBER_ORIGIN_IDX
    See Also:
      - Constant Field Values

  - ### MEMBER_MODIFIER_IDX

    public static final int MEMBER_MODIFIER_IDX
    See Also:
      - Constant Field Values

  - ### MEMBER_DECLARER_IDX

    public static final int MEMBER_DECLARER_IDX
    See Also:
      - Constant Field Values

  - ### MEMBER_TYPE_IDX

    public static final int MEMBER_TYPE_IDX
    See Also:
      - Constant Field Values

  - ### MEMBER_NAME_IDX

    public static final int MEMBER_NAME_IDX
    See Also:
      - Constant Field Values

  - ### MEMBER_PARAMS_IDX

    public static final int MEMBER_PARAMS_IDX
    See Also:
      - Constant Field Values

  - ### MEMBER_VALUE_IDX

    public static final int MEMBER_VALUE_IDX
    See Also:
      - Constant Field Values

  - ### MEMBER_EXCEPTIONS_IDX

    public static final int MEMBER_EXCEPTIONS_IDX
    See Also:
      - Constant Field Values

  - ### NOT_APPLICABLE

    public static final String NOT_APPLICABLE
    See Also:
      - Constant Field Values

  - ### GROOVY

    public static final String GROOVY
    See Also:
      - Constant Field Values

  - ### JAVA

    public static final String JAVA
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### Inspector

    public Inspector(Object objectUnderInspection)
    Parameters:
      `objectUnderInspection` - must not be null

- ## Method Details

  - ### getClassProps

    public String[] getClassProps()
    Get the Class Properties of the object under inspection.
    Returns:
      String array to be indexed by the CLASS_xxx_IDX constants

  - ### isGroovy

    public boolean isGroovy()

  - ### getObject

    public Object getObject()
    Gets the object being inspected.
    Returns:
      the object

  - ### getMethods

    public Object[] getMethods()
    Get info about usual Java instance and class Methods as well as Constructors.
    Returns:
      Array of StringArrays that can be indexed with the MEMBER_xxx_IDX constants

  - ### getMethodsWithInfo

    public Tuple2[] getMethodsWithInfo()
    Get info about usual Java instance and class Methods as well as Constructors.

  - ### getMetaMethods

    public Object[] getMetaMethods()
    Get info about instance and class Methods that are dynamically added through Groovy.
    Returns:
      Array of StringArrays that can be indexed with the MEMBER_xxx_IDX constants

  - ### getMetaMethodsWithInfo

    public Tuple2[] getMetaMethodsWithInfo()
    Get info about instance and class Methods that are dynamically added through Groovy.

  - ### getPublicFields

    public Object[] getPublicFields()
    Get info about usual Java public fields incl. constants.
    Returns:
      Array of StringArrays that can be indexed with the MEMBER_xxx_IDX constants

  - ### getPropertyInfo

    public Object[] getPropertyInfo()
    Get info about Properties (Java and Groovy alike).
    Returns:
      Array of StringArrays that can be indexed with the MEMBER_xxx_IDX constants

  - ### fieldInfo

    protected String[] fieldInfo(Field field)

  - ### fieldInfo

    protected String[] fieldInfo(PropertyValue pv)

  - ### getPropertiesWithInfo

    public Object[] getPropertiesWithInfo()

  - ### fieldWithInfo

    protected Tuple2<Object,String[]> fieldWithInfo(PropertyValue pv)

  - ### getClassUnderInspection

    protected Class getClassUnderInspection()

  - ### shortName

    public static String shortName(Class clazz)

  - ### methodInfo

    protected String[] methodInfo(Method method)

  - ### methodInfo

    protected String[] methodInfo(Constructor ctor)

  - ### methodInfo

    protected String[] methodInfo(MetaMethod method)

  - ### withoutNulls

    protected String[] withoutNulls(String[] toNormalize)

  - ### print

    public static void print(Object[] memberInfo)

  - ### sort

    public static Collection sort(List<Object> memberInfo)

  - ### sort

    public static Collection sort(List<Object> memberInfo, Comparator<Object> comparator)