groovy.inspect
Class Inspector

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

author:
Dierk Koenig

Field Summary
 int CLASS_CLASS_IDX
           
 int CLASS_INTERFACE_IDX
           
 int CLASS_OTHER_IDX
           
 int CLASS_PACKAGE_IDX
           
 int CLASS_SUPERCLASS_IDX
           
 String GROOVY
           
 String JAVA
           
 int MEMBER_DECLARER_IDX
           
 int MEMBER_EXCEPTIONS_IDX
           
 int MEMBER_MODIFIER_IDX
           
 int MEMBER_NAME_IDX
           
 int MEMBER_ORIGIN_IDX
           
 int MEMBER_PARAMS_IDX
           
 int MEMBER_TYPE_IDX
           
 int MEMBER_VALUE_IDX
           
 String NOT_APPLICABLE
           
 Object objectUnderInspection
           
 
Constructor Summary
Inspector(Object objectUnderInspection)
           
 
Method Summary
def fieldInfo(Field field)
          
def fieldInfo(PropertyValue pv)
          
def getClassProps()
           Get the Class Properties of the object under inspection.
Class getClassUnderInspection()
          
def getMetaMethods()
           Get info about instance and class Methods that are dynamically added through Groovy.
def getMethods()
           Get info about usual Java instance and class Methods as well as Constructors.
Object getObject()
           Gets the object being inspected.
def getPropertyInfo()
           Get info about Properties (Java and Groovy alike).
def getPublicFields()
           Get info about usual Java public fields incl. constants.
boolean isGroovy()
          
def methodInfo(Method method)
          
def methodInfo(Constructor ctor)
          
def methodInfo(MetaMethod method)
          
static void print(def memberInfo)
          
static void print(PrintStream out, def memberInfo)
          
static String shortName(Class clazz)
          
static Collection sort(List memberInfo)
          
def withoutNulls(def toNormalize)
          
 

Constructor Detail

Inspector

public Inspector(Object objectUnderInspection)
param:
objectUnderInspection must not be null


Method Detail

fieldInfo

def fieldInfo(Field field)


fieldInfo

def fieldInfo(PropertyValue pv)


getClassProps

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


getClassUnderInspection

Class getClassUnderInspection()


getMetaMethods

public def 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 def 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.


getPropertyInfo

public def 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 def 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

def methodInfo(Method method)


methodInfo

def methodInfo(Constructor ctor)


methodInfo

def methodInfo(MetaMethod method)


print

public static void print(def memberInfo)


print

public static void print(PrintStream out, def memberInfo)


shortName

public static String shortName(Class clazz)


sort

public static Collection sort(List memberInfo)


withoutNulls

def withoutNulls(def toNormalize)