Inspector (Groovy 5.0.8)

Package: groovy.inspect

## [Java] Class Inspector

- 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
    Modifiers | Name | Description
    --- | --- | ---
    `static class` | `Inspector.MemberComparator` |
    `static class` | `Inspector.MemberComparatorWithValue` |

  - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static int` | `CLASS_CLASS_IDX` |
    `static int` | `CLASS_INTERFACE_IDX` |
    `static int` | `CLASS_OTHER_IDX` |
    `static int` | `CLASS_PACKAGE_IDX` |
    `static int` | `CLASS_SUPERCLASS_IDX` |
    `static String` | `GROOVY` |
    `static String` | `JAVA` |
    `static int` | `MEMBER_DECLARER_IDX` |
    `static int` | `MEMBER_EXCEPTIONS_IDX` |
    `static int` | `MEMBER_MODIFIER_IDX` |
    `static int` | `MEMBER_NAME_IDX` |
    `static int` | `MEMBER_ORIGIN_IDX` |
    `static int` | `MEMBER_PARAMS_IDX` |
    `static int` | `MEMBER_TYPE_IDX` |
    `static int` | `MEMBER_VALUE_IDX` |
    `static String` | `NOT_APPLICABLE` |
    `protected Object` | `objectUnderInspection` |

  - ### Constructor Summary

    Constructors
    Constructor and description
    `Inspector(Object objectUnderInspection)` Parameters: `objectUnderInspection` - must not be null

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `protected String[]` | `fieldInfo(Field field)`
    `` | `protected String[]` | `fieldInfo(PropertyValue pv)`
    `` | `protected Tuple2<Object, String>` | `fieldWithInfo(PropertyValue pv)`
    `` | `public String[]` | `getClassProps()` Get the Class Properties of the object under inspection.
    `` | `protected Class` | `getClassUnderInspection()`
    `` | `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()`
    `` | `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()`
    `` | `protected String[]` | `methodInfo(Method method)`
    `` | `protected String[]` | `methodInfo(Constructor ctor)`
    `` | `protected String[]` | `methodInfo(MetaMethod method)`
    `` | `public static void` | `print(Object[] memberInfo)`
    `` | `public static String` | `shortName(Class clazz)`
    `` | `public static Collection` | `sort(List<Object> memberInfo)`
    `` | `public static Collection` | `sort(List<Object> memberInfo, Comparator<Object> comparator)`
    `` | `protected String[]` | `withoutNulls(String[] toNormalize)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### public static final int CLASS_CLASS_IDX

    - #### public static final int CLASS_INTERFACE_IDX

    - #### public static final int CLASS_OTHER_IDX

    - #### public static final int CLASS_PACKAGE_IDX

    - #### public static final int CLASS_SUPERCLASS_IDX

    - #### public static final String GROOVY

    - #### public static final String JAVA

    - #### public static final int MEMBER_DECLARER_IDX

    - #### public static final int MEMBER_EXCEPTIONS_IDX

    - #### public static final int MEMBER_MODIFIER_IDX

    - #### public static final int MEMBER_NAME_IDX

    - #### public static final int MEMBER_ORIGIN_IDX

    - #### public static final int MEMBER_PARAMS_IDX

    - #### public static final int MEMBER_TYPE_IDX

    - #### public static final int MEMBER_VALUE_IDX

    - #### public static final String NOT_APPLICABLE

    - #### protected Object objectUnderInspection

  - ### Constructor Detail

    - #### public Inspector(Object objectUnderInspection)

      Parameters:
        `objectUnderInspection` - must not be null

  - ### Method Detail

    - #### protected String[] fieldInfo(Field field)

    - #### protected String[] fieldInfo(PropertyValue pv)

    - #### protected Tuple2<Object, String> fieldWithInfo(PropertyValue pv)

    - #### public String[] getClassProps()

      Get the Class Properties of the object under inspection.

      Returns:
        String array to be indexed by the CLASS_xxx_IDX constants

    - #### protected Class getClassUnderInspection()

    - #### 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

    - #### 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.

      Returns:
        Array of StringArrays that can be indexed with the MEMBER_xxx_IDX constants

    - #### public Tuple2[] getMethodsWithInfo()

      Get info about usual Java instance and class Methods as well as Constructors.

    - #### public Object getObject()

      Gets the object being inspected.

      Returns:
        the object

    - #### public Object[] getPropertiesWithInfo()

    - #### 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

    - #### 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

    - #### public boolean isGroovy()

    - #### protected String[] methodInfo(Method method)

    - #### protected String[] methodInfo(Constructor ctor)

    - #### protected String[] methodInfo(MetaMethod method)

    - #### public static void print(Object[] memberInfo)

    - #### public static String shortName(Class clazz)

    - #### public static Collection sort(List<Object> memberInfo)

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

    - #### protected String[] withoutNulls(String[] toNormalize)