Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## groovy.inspect
[Java] Class Inspector

    java.lang.Object
      groovy.inspect.Inspector

    public class Inspector
    extends java.lang.Object

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

Authors:
  Dierk Koenig

Nested Class Summary
`static class` | `Inspector.MemberComparator`

Field Summary
`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 java.lang.String` | `GROOVY`
`static java.lang.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 java.lang.String` | `NOT_APPLICABLE`
`protected java.lang.Object` | `objectUnderInspection`

Constructor Summary
`Inspector(java.lang.Object objectUnderInspection)` @param objectUnderInspection must not be null

Method Summary
`protected java.lang.String[]` | `fieldInfo(Field field)`
`protected java.lang.String[]` | `fieldInfo(PropertyValue pv)`
`java.lang.String[]` | `getClassProps()` Get the Class Properties of the object under inspection.
`protected java.lang.Class` | `getClassUnderInspection()`
`java.lang.Object[]` | `getMetaMethods()` Get info about instance and class Methods that are dynamically added through Groovy.
`java.lang.Object[]` | `getMethods()` Get info about usual Java instance and class Methods as well as Constructors.
`java.lang.Object` | `getObject()` Gets the object being inspected.
`java.lang.Object[]` | `getPropertyInfo()` Get info about Properties (Java and Groovy alike).
`java.lang.Object[]` | `getPublicFields()` Get info about usual Java public fields incl. constants.
`boolean` | `isGroovy()`
`protected java.lang.String[]` | `methodInfo(java.lang.reflect.Method method)`
`protected java.lang.String[]` | `methodInfo(java.lang.reflect.Constructor ctor)`
`protected java.lang.String[]` | `methodInfo(MetaMethod method)`
`static void` | `print(java.lang.Object[] memberInfo)`
`static java.lang.String` | `shortName(java.lang.Class clazz)`
`static java.util.Collection` | `sort(java.util.List memberInfo)`
`protected java.lang.String[]` | `withoutNulls(java.lang.String[] toNormalize)`

Methods inherited from class java.lang.Object
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Field Detail

### CLASS_CLASS_IDX

    public static final int CLASS_CLASS_IDX

### CLASS_INTERFACE_IDX

    public static final int CLASS_INTERFACE_IDX

### CLASS_OTHER_IDX

    public static final int CLASS_OTHER_IDX

### CLASS_PACKAGE_IDX

    public static final int CLASS_PACKAGE_IDX

### CLASS_SUPERCLASS_IDX

    public static final int CLASS_SUPERCLASS_IDX

### GROOVY

    public static final java.lang.String GROOVY

### JAVA

    public static final java.lang.String JAVA

### MEMBER_DECLARER_IDX

    public static final int MEMBER_DECLARER_IDX

### MEMBER_EXCEPTIONS_IDX

    public static final int MEMBER_EXCEPTIONS_IDX

### MEMBER_MODIFIER_IDX

    public static final int MEMBER_MODIFIER_IDX

### MEMBER_NAME_IDX

    public static final int MEMBER_NAME_IDX

### MEMBER_ORIGIN_IDX

    public static final int MEMBER_ORIGIN_IDX

### MEMBER_PARAMS_IDX

    public static final int MEMBER_PARAMS_IDX

### MEMBER_TYPE_IDX

    public static final int MEMBER_TYPE_IDX

### MEMBER_VALUE_IDX

    public static final int MEMBER_VALUE_IDX

### NOT_APPLICABLE

    public static final java.lang.String NOT_APPLICABLE

### objectUnderInspection

    protected java.lang.Object objectUnderInspection

Constructor Detail

### Inspector

    public Inspector(java.lang.Object objectUnderInspection)

  Parameters:
    `objectUnderInspection` - must not be null

Method Detail

### fieldInfo

    protected java.lang.String[] fieldInfo(Field field)

### fieldInfo

    protected java.lang.String[] fieldInfo(PropertyValue pv)

### getClassProps

    public java.lang.String[] getClassProps()

  Get the Class Properties of the object under inspection.
  Returns:
    String array to be indexed by the CLASS_xxx_IDX constants

### getClassUnderInspection

    protected java.lang.Class getClassUnderInspection()

### getMetaMethods

    public java.lang.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

### getMethods

    public java.lang.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

### getObject

    public java.lang.Object getObject()

  Gets the object being inspected.
  Returns:
    the object

### getPropertyInfo

    public java.lang.Object[] getPropertyInfo()

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

### getPublicFields

    public java.lang.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

### isGroovy

    public boolean isGroovy()

### methodInfo

    protected java.lang.String[] methodInfo(java.lang.reflect.Method method)

### methodInfo

    protected java.lang.String[] methodInfo(java.lang.reflect.Constructor ctor)

### methodInfo

    protected java.lang.String[] methodInfo(MetaMethod method)

### print

    public static void print(java.lang.Object[] memberInfo)

### shortName

    public static java.lang.String shortName(java.lang.Class clazz)

### sort

    public static java.util.Collection sort(java.util.List memberInfo)

### withoutNulls

    protected java.lang.String[] withoutNulls(java.lang.String[] toNormalize)

Groovy Documentation