org.granite.messaging.reflect
Class Reflection

java.lang.Object
  extended by org.granite.messaging.reflect.Reflection

public class Reflection
extends Object

Author:
Franck WOLFF

Nested Class Summary
protected static class Reflection.AnnotatedPropertyKey
           
protected static class Reflection.NameTypePropertyKey
           
protected static interface Reflection.SinglePropertyKey
           
 
Field Summary
protected  ClassLoader classLoader
           
protected  BypassConstructorAllocator instanceFactory
           
protected  Comparator<Property> lexicalPropertyComparator
           
protected static Property NULL_PROPERTY
           
protected  ConcurrentMap<Class<?>,List<Property>> serializablePropertiesCache
           
protected  ConcurrentMap<Reflection.SinglePropertyKey,Property> singlePropertyCache
           
protected static int STATIC_PRIVATE_PROTECTED_MASK
           
protected static int STATIC_TRANSIENT_MASK
           
 
Constructor Summary
Reflection(ClassLoader classLoader)
           
Reflection(ClassLoader classLoader, BypassConstructorAllocator instanceFactory)
           
 
Method Summary
 Property findProperty(Class<?> cls, Class<? extends Annotation> annotationClass)
           
 Property findProperty(Class<?> cls, String name, Class<?> type)
           
protected  List<Property> findSerializableDeclaredProperties(Class<?> cls)
           
 List<Property> findSerializableProperties(Class<?> cls)
           
 Property findSerializableProperty(Class<?> cls, String name)
           
 ClassLoader getClassLoader()
           
 boolean isRegularClass(Class<?> cls)
           
 Class<?> loadClass(String className)
           
protected  FieldProperty newFieldProperty(Field field)
           
<T> T
newInstance(Class<T> cls)
           
<T> T
newInstance(String className)
           
protected  MethodProperty newMethodProperty(Method getter, Method setter, String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATIC_TRANSIENT_MASK

protected static final int STATIC_TRANSIENT_MASK
See Also:
Constant Field Values

STATIC_PRIVATE_PROTECTED_MASK

protected static final int STATIC_PRIVATE_PROTECTED_MASK
See Also:
Constant Field Values

NULL_PROPERTY

protected static final Property NULL_PROPERTY

classLoader

protected final ClassLoader classLoader

instanceFactory

protected final BypassConstructorAllocator instanceFactory

lexicalPropertyComparator

protected final Comparator<Property> lexicalPropertyComparator

serializablePropertiesCache

protected final ConcurrentMap<Class<?>,List<Property>> serializablePropertiesCache

singlePropertyCache

protected final ConcurrentMap<Reflection.SinglePropertyKey,Property> singlePropertyCache
Constructor Detail

Reflection

public Reflection(ClassLoader classLoader)

Reflection

public Reflection(ClassLoader classLoader,
                  BypassConstructorAllocator instanceFactory)
Method Detail

getClassLoader

public ClassLoader getClassLoader()

loadClass

public Class<?> loadClass(String className)
                   throws ClassNotFoundException
Throws:
ClassNotFoundException

newInstance

public <T> T newInstance(Class<T> cls)
              throws InstantiationException,
                     IllegalAccessException,
                     IllegalArgumentException,
                     InvocationTargetException,
                     SecurityException,
                     NoSuchMethodException
Throws:
InstantiationException
IllegalAccessException
IllegalArgumentException
InvocationTargetException
SecurityException
NoSuchMethodException

newInstance

public <T> T newInstance(String className)
              throws ClassNotFoundException,
                     InstantiationException,
                     IllegalAccessException,
                     IllegalArgumentException,
                     InvocationTargetException,
                     SecurityException,
                     NoSuchMethodException
Throws:
ClassNotFoundException
InstantiationException
IllegalAccessException
IllegalArgumentException
InvocationTargetException
SecurityException
NoSuchMethodException

findSerializableProperty

public Property findSerializableProperty(Class<?> cls,
                                         String name)
                                  throws SecurityException
Throws:
SecurityException

findSerializableProperties

public List<Property> findSerializableProperties(Class<?> cls)
                                          throws SecurityException
Throws:
SecurityException

newFieldProperty

protected FieldProperty newFieldProperty(Field field)

newMethodProperty

protected MethodProperty newMethodProperty(Method getter,
                                           Method setter,
                                           String name)

findSerializableDeclaredProperties

protected List<Property> findSerializableDeclaredProperties(Class<?> cls)
                                                     throws SecurityException
Throws:
SecurityException

isRegularClass

public boolean isRegularClass(Class<?> cls)

findProperty

public Property findProperty(Class<?> cls,
                             String name,
                             Class<?> type)

findProperty

public Property findProperty(Class<?> cls,
                             Class<? extends Annotation> annotationClass)