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

## groovy.inspect
Class Inspector

    java.lang.Object
      groovy.inspect.Inspector

    class Inspector
    extends Object

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

author:
  Dierk Koenig

Nested Class Summary
`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 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
`Inspector(Object objectUnderInspection)`

Method Summary
`protected String[]` | `fieldInfo(Field field)`
`protected String[]` | `fieldInfo(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.
`Object[]` | `getMethods()` Get info about usual Java instance and class Methods as well as Constructors.
`Object` | `getObject()` Gets the object being inspected.
`Object[]` | `getPropertyInfo()` Get info about Properties (Java and Groovy alike).
`Object[]` | `getPublicFields()` Get info about usual Java public fields incl. constants.
`boolean` | `isGroovy()`
`protected String[]` | `methodInfo(Method method)`
`protected String[]` | `methodInfo(Constructor ctor)`
`protected String[]` | `methodInfo(MetaMethod method)`
`static void` | `print(Object[] memberInfo)`
`static void` | `print(PrintStream out, Object[] memberInfo)`
`static String` | `shortName(Class clazz)`
`static Collection` | `sort(List memberInfo)`
`protected String[]` | `withoutNulls(String[] toNormalize)`

Methods inherited from class Object
wait, wait, wait, hashCode, getClass, equals, toString, notify, notifyAll

Field Detail

### CLASS_CLASS_IDX

    static final int CLASS_CLASS_IDX

### CLASS_INTERFACE_IDX

    static final int CLASS_INTERFACE_IDX

### CLASS_OTHER_IDX

    static final int CLASS_OTHER_IDX

### CLASS_PACKAGE_IDX

    static final int CLASS_PACKAGE_IDX

### CLASS_SUPERCLASS_IDX

    static final int CLASS_SUPERCLASS_IDX

### GROOVY

    static final String GROOVY

### JAVA

    static final String JAVA

### MEMBER_DECLARER_IDX

    static final int MEMBER_DECLARER_IDX

### MEMBER_EXCEPTIONS_IDX

    static final int MEMBER_EXCEPTIONS_IDX

### MEMBER_MODIFIER_IDX

    static final int MEMBER_MODIFIER_IDX

### MEMBER_NAME_IDX

    static final int MEMBER_NAME_IDX

### MEMBER_ORIGIN_IDX

    static final int MEMBER_ORIGIN_IDX

### MEMBER_PARAMS_IDX

    static final int MEMBER_PARAMS_IDX

### MEMBER_TYPE_IDX

    static final int MEMBER_TYPE_IDX

### MEMBER_VALUE_IDX

    static final int MEMBER_VALUE_IDX

### NOT_APPLICABLE

    static final String NOT_APPLICABLE

### objectUnderInspection

    protected Object objectUnderInspection

Constructor Detail

### Inspector

    public Inspector(Object objectUnderInspection)

  param:
    objectUnderInspection must not be null

Method Detail

### fieldInfo

    protected String[] fieldInfo(Field field)

### fieldInfo

    protected String[] fieldInfo(PropertyValue pv)

### getClassProps

    public String[] getClassProps()

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

### getClassUnderInspection

    protected Class getClassUnderInspection()

### getMetaMethods

    public Object[] getMetaMethods()

  Get info about instance and class Methods that are dynamically added through Groovy.
  return:
    Array of StringArrays that can be indexed with the MEMBER_xxx_IDX constants

### getMethods

    public Object[] getMethods()

  Get info about usual Java instance and class Methods as well as Constructors.
  return:
    Array of StringArrays that can be indexed with the MEMBER_xxx_IDX constants

### getObject

    public Object getObject()

  Gets the object being inspected.
  return:
    the object

### getPropertyInfo

    public Object[] getPropertyInfo()

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

### getPublicFields

    public Object[] getPublicFields()

  Get info about usual Java public fields incl. constants.
  return:
    Array of StringArrays that can be indexed with the MEMBER_xxx_IDX constants

### isGroovy

    public boolean isGroovy()

### methodInfo

    protected String[] methodInfo(Method method)

### methodInfo

    protected String[] methodInfo(Constructor ctor)

### methodInfo

    protected String[] methodInfo(MetaMethod method)

### print

    public static void print(Object[] memberInfo)

### print

    public static void print(PrintStream out, Object[] memberInfo)

### shortName

    public static String shortName(Class clazz)

### sort

    public static Collection sort(List memberInfo)

### withoutNulls

    protected String[] withoutNulls(String[] toNormalize)

Copyright © 2003-2009 The Codehaus. All rights reserved.