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.
  • Field Details

  • Constructor Details

    • Inspector

      public Inspector​(java.lang.Object objectUnderInspection)
      Parameters:
      objectUnderInspection - must not be null
  • Method Details

    • 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
    • isGroovy

      public boolean isGroovy()
    • getObject

      public java.lang.Object getObject()
      Gets the object being inspected.
      Returns:
      the object
    • 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
    • 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
    • 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
    • getPublicFieldsWithInfo

      public java.lang.Object[] getPublicFieldsWithInfo()
    • 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
    • fieldInfo

      protected java.lang.String[] fieldInfo​(java.lang.reflect.Field field)
    • fieldWithInfo

      protected Tuple2<java.lang.Object,​java.lang.String[]> fieldWithInfo​(java.lang.reflect.Field field)
    • fieldInfo

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

      protected Tuple2<java.lang.Object,​java.lang.String[]> fieldWithInfo​(PropertyValue pv)
    • getPropertiesWithInfo

      public java.lang.Object[] getPropertiesWithInfo()
    • getClassUnderInspection

      protected java.lang.Class getClassUnderInspection()
    • shortName

      public static java.lang.String shortName​(java.lang.Class clazz)
    • 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)
    • withoutNulls

      protected java.lang.String[] withoutNulls​(java.lang.String[] toNormalize)
    • print

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

      public static java.util.Collection sort​(java.util.List<java.lang.Object> memberInfo)
    • sort

      public static java.util.Collection sort​(java.util.List<java.lang.Object> memberInfo, java.util.Comparator<java.lang.Object> comparator)