Griffon 0.9.5-rc2

org.codehaus.griffon.runtime.core
[Java] Class ClassPropertyFetcher

java.lang.Object
  org.codehaus.griffon.runtime.core.ClassPropertyFetcher

public class ClassPropertyFetcher
extends Object

Accesses class "properties": static fields, static getters, instance fields or instance getters

Method and Field instances are cached for fast access

Authors:
Lari Hotari, Sagire Software Oy (Grails)
Andres Almiray
Since:
0.9.1


Nested Class Summary
static interface ClassPropertyFetcher.FieldCallback

static class ClassPropertyFetcher.FieldReaderFetcher

static class ClassPropertyFetcher.GetterPropertyFetcher

static interface ClassPropertyFetcher.MethodCallback

static interface ClassPropertyFetcher.PropertyFetcher

static interface ClassPropertyFetcher.ReferenceInstanceCallback

 
Field Summary
private static Map cachedClassPropertyFetchers

private ClassPropertyFetcher.ReferenceInstanceCallback callback

private Class clazz

Map instanceFetchers

private String[] propertiesWithFields

private PropertyDescriptor[] propertyDescriptors

Map staticFetchers

 
Constructor Summary
ClassPropertyFetcher(Class clazz, ClassPropertyFetcher.ReferenceInstanceCallback callback)

 
Method Summary
static void clearClassPropertyFetcherCache()

static ClassPropertyFetcher forClass(Class c)

static ClassPropertyFetcher forClass(Class c, ClassPropertyFetcher.ReferenceInstanceCallback callback)

String[] getPropertiesWithFields()

PropertyDescriptor[] getPropertyDescriptors()

Class getPropertyType(String name)

Class getPropertyType(String name, boolean onlyInstanceProperties)

Object getPropertyValue(String name)

Object getPropertyValue(String name, boolean onlyInstanceProperties)

Object getPropertyValue(String name, Class c)

private Object getPropertyValueWithFetcher(String name, ClassPropertyFetcher.PropertyFetcher fetcher)

Object getReference()

Object getStaticPropertyValue(String name, Class c)

private void init()

boolean isReadableProperty(String name)

private static void makeAccessible(AccessibleObject obj)

private List resolveAllClasses(Class c)

private ClassPropertyFetcher.PropertyFetcher resolveFetcher(String name, boolean onlyInstanceProperties)

private Object returnOnlyIfInstanceOf(Object value, Class type)

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

Field Detail

cachedClassPropertyFetchers

private static Map cachedClassPropertyFetchers


callback

private final ClassPropertyFetcher.ReferenceInstanceCallback callback


clazz

private final Class clazz


instanceFetchers

final Map instanceFetchers


propertiesWithFields

private String[] propertiesWithFields


propertyDescriptors

private PropertyDescriptor[] propertyDescriptors


staticFetchers

final Map staticFetchers


 
Constructor Detail

ClassPropertyFetcher

ClassPropertyFetcher(Class clazz, ClassPropertyFetcher.ReferenceInstanceCallback callback)


 
Method Detail

clearClassPropertyFetcherCache

public static void clearClassPropertyFetcherCache()


forClass

public static ClassPropertyFetcher forClass(Class c)


forClass

public static ClassPropertyFetcher forClass(Class c, ClassPropertyFetcher.ReferenceInstanceCallback callback)


getPropertiesWithFields

public String[] getPropertiesWithFields()


getPropertyDescriptors

public PropertyDescriptor[] getPropertyDescriptors()


getPropertyType

public Class getPropertyType(String name)


getPropertyType

public Class getPropertyType(String name, boolean onlyInstanceProperties)


getPropertyValue

public Object getPropertyValue(String name)


getPropertyValue

public Object getPropertyValue(String name, boolean onlyInstanceProperties)


getPropertyValue

public Object getPropertyValue(String name, Class c)


getPropertyValueWithFetcher

private Object getPropertyValueWithFetcher(String name, ClassPropertyFetcher.PropertyFetcher fetcher)


getReference

public Object getReference()


getStaticPropertyValue

public Object getStaticPropertyValue(String name, Class c)


init

private void init()


isReadableProperty

public boolean isReadableProperty(String name)


makeAccessible

private static void makeAccessible(AccessibleObject obj)


resolveAllClasses

private List resolveAllClasses(Class c)


resolveFetcher

private ClassPropertyFetcher.PropertyFetcher resolveFetcher(String name, boolean onlyInstanceProperties)


returnOnlyIfInstanceOf

@SuppressWarnings("unchecked")
private Object returnOnlyIfInstanceOf(Object value, Class type)


 

Groovy Documentation