net.sf.morph.reflect.reflectors
Class SimpleDelegatingReflector

java.lang.Object
  extended by net.sf.morph.reflect.reflectors.BaseReflector
      extended by net.sf.morph.reflect.reflectors.BaseCompositeReflector
          extended by net.sf.morph.reflect.reflectors.SimpleDelegatingReflector
All Implemented Interfaces:
java.lang.Cloneable, net.sf.composite.Component, net.sf.composite.Composite, net.sf.composite.SpecializableComposite, net.sf.composite.StrictlyTypedComposite, BeanReflector, CompositeReflector, ContainerReflector, DecoratedReflector, GrowableContainerReflector, IndexedContainerReflector, InstantiatingReflector, MutableIndexedContainerReflector, Reflector, SizableReflector

public class SimpleDelegatingReflector
extends BaseCompositeReflector
implements DecoratedReflector, net.sf.composite.StrictlyTypedComposite, net.sf.composite.SpecializableComposite, BeanReflector, ContainerReflector, GrowableContainerReflector, IndexedContainerReflector, InstantiatingReflector, MutableIndexedContainerReflector, CompositeReflector, java.lang.Cloneable

Reflector that can be used to combine multiple bean reflectors. By default, a new instance of this reflector will include all reflectors defined in Morph except the MapReflector (the MapBeanReflector is used instead).

Since:
Dec 13, 2004
Author:
Matt Sgarlata

Field Summary
 
Fields inherited from class net.sf.morph.reflect.reflectors.BaseReflector
log
 
Fields inherited from interface net.sf.morph.reflect.BeanReflector
IMPLICIT_PROPERTY_CLASS, IMPLICIT_PROPERTY_PROPERTY_NAMES, IMPLICIT_PROPERTY_THIS
 
Constructor Summary
SimpleDelegatingReflector()
          Construct a new SimpleDelegatingReflector.
SimpleDelegatingReflector(Reflector[] components)
          Construct a new SimpleDelegatingReflector.
SimpleDelegatingReflector(Reflector[] components, boolean appendDefaultComponents)
          Construct a new SimpleDelegatingReflector.
 
Method Summary
protected  boolean addImpl(java.lang.Object container, java.lang.Object value)
          Implementation of GrowableContainer.add(Object).
protected  Reflector[] createDefaultComponents()
           
protected  BeanReflector getBeanReflector(java.lang.Object bean)
           
 java.lang.Object[] getComponents()
           
protected  java.lang.Class getContainedTypeImpl(java.lang.Class clazz)
          Implementation of ContainerReflector.getContainedType(Class).
protected  ContainerReflector getContainerReflector(java.lang.Object bean)
           
protected  ContainerReflector getContainerReflectorForClass(java.lang.Class reflectedClass)
           
protected  GrowableContainerReflector getGrowableContainerReflector(java.lang.Object bean)
           
protected  java.lang.Object getImpl(java.lang.Object container, int index)
          Implementation of IndexedContainerReflector.get(Object, int).
protected  java.lang.Object getImpl(java.lang.Object bean, java.lang.String propertyName)
          Implementation of BeanReflector.get(Object, String).
protected  IndexedContainerReflector getIndexedContainerReflector(java.lang.Object bean)
           
protected  InstantiatingReflector getInstantiatingReflectorForClass(java.lang.Class clazz)
           
protected  java.util.Iterator getIteratorImpl(java.lang.Object container)
          Implementation of ContainerReflector.getIterator(Object).
protected  MutableIndexedContainerReflector getMutableIndexedContainerReflector(java.lang.Object bean)
           
protected  java.lang.String[] getPropertyNamesImpl(java.lang.Object bean)
          Implementation of BeanReflector.getPropertyNames(Object).
protected  java.lang.Class[] getReflectableClassesImpl()
          Implementation of Reflector.getReflectableClasses().
protected  Reflector getReflector(java.lang.Class reflectorType, java.lang.Class reflectedType)
           
protected  SizableReflector getSizableReflector(java.lang.Object bean)
           
protected  int getSizeImpl(java.lang.Object container)
          Implementation of SizableReflector.getSize(Object).
protected  java.lang.Class getTypeImpl(java.lang.Object bean, java.lang.String propertyName)
          Implementation of BeanReflector.getType(Object, String).
protected  void initializeImpl()
          Implementation of BaseReflector.initialize().
protected  boolean isReadableImpl(java.lang.Object bean, java.lang.String propertyName)
          Implementation of BeanReflector.isReadable(Object, String).
 boolean isReflectableImpl(java.lang.Class reflectedType, java.lang.Class reflectorType)
          Implementation of BaseReflector.isReflectable(Class, Class).
protected  boolean isWriteableImpl(java.lang.Object bean, java.lang.String propertyName)
          Implementation of BeanReflector.isWriteable(Object, String).
protected  java.lang.Object newInstanceImpl(java.lang.Class clazz, java.lang.Object parameters)
          Implementation of InstantiatingReflector.newInstance(Class, Object).
protected  java.lang.Object setImpl(java.lang.Object container, int index, java.lang.Object propertyValue)
          Implementation of MutableIndexedContainerReflector.set(Object, int, Object).
protected  void setImpl(java.lang.Object bean, java.lang.String propertyName, java.lang.Object value)
          Implementation of BeanReflector.set(Object, String, Object).
 
Methods inherited from class net.sf.morph.reflect.reflectors.BaseCompositeReflector
clone, getComponentType, getComponentValidator, getSpecializer, isPerformingLogging, isSpecializable, setComponents, setComponentValidator, setSpecializer, specialize, toString
 
Methods inherited from class net.sf.morph.reflect.reflectors.BaseReflector
add, checkIndex, checkIsReflectable, createWrapperInvocationHandler, get, get, getContainedType, getIterator, getPropertyNames, getReflectableCallCache, getReflectableClasses, getReflectorName, getSize, getType, getWrapper, getWrapperImpl, initialize, isCachingIsReflectableCalls, isInitialized, isReadable, isReflectable, isReflectable, isReflectableImpl, isStrictlyTyped, isValidIndex, isWrappingRuntimeExceptions, isWriteable, newInstance, newInstanceImpl, set, set, setCachingIsReflectableCalls, setInitialized, setReflectableCallCache, setReflectorName
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.morph.reflect.DecoratedReflector
isReflectable
 
Methods inherited from interface net.sf.morph.reflect.Reflector
getReflectableClasses, getWrapper
 
Methods inherited from interface net.sf.composite.StrictlyTypedComposite
getComponentType
 
Methods inherited from interface net.sf.composite.SpecializableComposite
isSpecializable, specialize
 
Methods inherited from interface net.sf.morph.reflect.BeanReflector
get, getPropertyNames, getType, isReadable, isWriteable, set
 
Methods inherited from interface net.sf.morph.reflect.Reflector
getReflectableClasses, getWrapper
 
Methods inherited from interface net.sf.morph.reflect.Reflector
getReflectableClasses, getWrapper
 
Methods inherited from interface net.sf.morph.reflect.GrowableContainerReflector
add
 
Methods inherited from interface net.sf.morph.reflect.Reflector
getReflectableClasses, getWrapper
 
Methods inherited from interface net.sf.morph.reflect.Reflector
getReflectableClasses, getWrapper
 
Methods inherited from interface net.sf.morph.reflect.Reflector
getReflectableClasses, getWrapper
 
Methods inherited from interface net.sf.morph.reflect.InstantiatingReflector
newInstance
 
Methods inherited from interface net.sf.morph.reflect.MutableIndexedContainerReflector
set
 
Methods inherited from interface net.sf.morph.reflect.Reflector
getReflectableClasses, getWrapper
 
Methods inherited from interface net.sf.morph.reflect.Reflector
getReflectableClasses, getWrapper
 
Methods inherited from interface net.sf.morph.reflect.CompositeReflector
isReflectable
 

Constructor Detail

SimpleDelegatingReflector

public SimpleDelegatingReflector()
Construct a new SimpleDelegatingReflector.


SimpleDelegatingReflector

public SimpleDelegatingReflector(Reflector[] components)
Construct a new SimpleDelegatingReflector.

Parameters:
components -

SimpleDelegatingReflector

public SimpleDelegatingReflector(Reflector[] components,
                                 boolean appendDefaultComponents)
Construct a new SimpleDelegatingReflector.

Parameters:
components -
appendDefaultComponents - if true, the components returned from createDefaultComponents() will be added.
Method Detail

createDefaultComponents

protected Reflector[] createDefaultComponents()

initializeImpl

protected void initializeImpl()
                       throws java.lang.Exception
Description copied from class: BaseReflector
Implementation of BaseReflector.initialize().

Overrides:
initializeImpl in class BaseReflector
Throws:
java.lang.Exception

getReflectableClassesImpl

protected java.lang.Class[] getReflectableClassesImpl()
Description copied from class: BaseReflector
Implementation of Reflector.getReflectableClasses().

Specified by:
getReflectableClassesImpl in class BaseReflector

getImpl

protected java.lang.Object getImpl(java.lang.Object bean,
                                   java.lang.String propertyName)
                            throws java.lang.Exception
Description copied from class: BaseReflector
Implementation of BeanReflector.get(Object, String). Implementation automatically provided for IndexedContainerReflectors. For other reflectors, throws an UnsupportedOperationException.

Overrides:
getImpl in class BaseReflector
Throws:
java.lang.Exception

getPropertyNamesImpl

protected java.lang.String[] getPropertyNamesImpl(java.lang.Object bean)
                                           throws java.lang.Exception
Description copied from class: BaseReflector
Implementation of BeanReflector.getPropertyNames(Object). Implementation automatically provided for IndexedContainerReflectors. For other reflectors, throws an UnsupportedOperationException.

Overrides:
getPropertyNamesImpl in class BaseReflector
Throws:
java.lang.Exception

getTypeImpl

protected java.lang.Class getTypeImpl(java.lang.Object bean,
                                      java.lang.String propertyName)
                               throws java.lang.Exception
Description copied from class: BaseReflector
Implementation of BeanReflector.getType(Object, String). Default implementation provided. For IndexedContainerReflectors, returns the type by calling ContainerReflector.getContainedType(Class). For other reflectors, checks the type of the property by calling BaseReflector.get(Object, String).

Overrides:
getTypeImpl in class BaseReflector
Throws:
java.lang.Exception

isReadableImpl

protected boolean isReadableImpl(java.lang.Object bean,
                                 java.lang.String propertyName)
                          throws java.lang.Exception
Description copied from class: BaseReflector
Implementation of BeanReflector.isReadable(Object, String). Default implementation assumes that all properties of the bean specified by BeanReflector.getPropertyNames(Object) are readable.

Overrides:
isReadableImpl in class BaseReflector
Throws:
java.lang.Exception

isWriteableImpl

protected boolean isWriteableImpl(java.lang.Object bean,
                                  java.lang.String propertyName)
                           throws java.lang.Exception
Description copied from class: BaseReflector
Implementation of BeanReflector.isWriteable(Object, String). Default implementation assumes that all readable properties are also writeable. One exception to this is when this reflector is an IndexedContainerReflector but not a MutableIndexedContainerReflector, in which case no properties are considered writeable.

Overrides:
isWriteableImpl in class BaseReflector
Throws:
java.lang.Exception

setImpl

protected void setImpl(java.lang.Object bean,
                       java.lang.String propertyName,
                       java.lang.Object value)
                throws java.lang.Exception
Description copied from class: BaseReflector
Implementation of BeanReflector.set(Object, String, Object). Implementation automatically provided for MutableIndexedContainerReflectors. For other reflectors, throws an UnsupportedOperationException.

Overrides:
setImpl in class BaseReflector
Throws:
java.lang.Exception

getIteratorImpl

protected java.util.Iterator getIteratorImpl(java.lang.Object container)
                                      throws java.lang.Exception
Description copied from class: BaseReflector
Implementation of ContainerReflector.getIterator(Object).

Overrides:
getIteratorImpl in class BaseReflector
Throws:
java.lang.Exception

getContainedTypeImpl

protected java.lang.Class getContainedTypeImpl(java.lang.Class clazz)
                                        throws java.lang.Exception
Description copied from class: BaseReflector
Implementation of ContainerReflector.getContainedType(Class).

Overrides:
getContainedTypeImpl in class BaseReflector
Throws:
java.lang.Exception

getSizeImpl

protected int getSizeImpl(java.lang.Object container)
                   throws java.lang.Exception
Description copied from class: BaseReflector
Implementation of SizableReflector.getSize(Object).

Overrides:
getSizeImpl in class BaseReflector
Throws:
java.lang.Exception

addImpl

protected boolean addImpl(java.lang.Object container,
                          java.lang.Object value)
                   throws java.lang.Exception
Description copied from class: BaseReflector
Implementation of GrowableContainer.add(Object).

Overrides:
addImpl in class BaseReflector
Throws:
java.lang.Exception

getImpl

protected java.lang.Object getImpl(java.lang.Object container,
                                   int index)
                            throws java.lang.Exception
Description copied from class: BaseReflector
Implementation of IndexedContainerReflector.get(Object, int).

Overrides:
getImpl in class BaseReflector
Throws:
java.lang.Exception

setImpl

protected java.lang.Object setImpl(java.lang.Object container,
                                   int index,
                                   java.lang.Object propertyValue)
                            throws java.lang.Exception
Description copied from class: BaseReflector
Implementation of MutableIndexedContainerReflector.set(Object, int, Object).

Overrides:
setImpl in class BaseReflector
Throws:
java.lang.Exception

newInstanceImpl

protected java.lang.Object newInstanceImpl(java.lang.Class clazz,
                                           java.lang.Object parameters)
                                    throws java.lang.Exception
Description copied from class: BaseReflector
Implementation of InstantiatingReflector.newInstance(Class, Object). Default implementation returns a new instance of the given class by calling Class#newInstance()).

Overrides:
newInstanceImpl in class BaseReflector
Throws:
java.lang.Exception

isReflectableImpl

public boolean isReflectableImpl(java.lang.Class reflectedType,
                                 java.lang.Class reflectorType)
                          throws ReflectionException
Description copied from class: BaseReflector
Implementation of BaseReflector.isReflectable(Class, Class).

Overrides:
isReflectableImpl in class BaseReflector
Throws:
ReflectionException

getReflector

protected Reflector getReflector(java.lang.Class reflectorType,
                                 java.lang.Class reflectedType)

getBeanReflector

protected BeanReflector getBeanReflector(java.lang.Object bean)

getContainerReflector

protected ContainerReflector getContainerReflector(java.lang.Object bean)

getContainerReflectorForClass

protected ContainerReflector getContainerReflectorForClass(java.lang.Class reflectedClass)

getGrowableContainerReflector

protected GrowableContainerReflector getGrowableContainerReflector(java.lang.Object bean)

getSizableReflector

protected SizableReflector getSizableReflector(java.lang.Object bean)

getIndexedContainerReflector

protected IndexedContainerReflector getIndexedContainerReflector(java.lang.Object bean)

getMutableIndexedContainerReflector

protected MutableIndexedContainerReflector getMutableIndexedContainerReflector(java.lang.Object bean)

getInstantiatingReflectorForClass

protected InstantiatingReflector getInstantiatingReflectorForClass(java.lang.Class clazz)

getComponents

public java.lang.Object[] getComponents()
Overrides:
getComponents in class BaseCompositeReflector


Copyright © 2004-2008.