net.sf.morph.reflect.reflectors
Class ResultSetReflector

java.lang.Object
  extended by net.sf.morph.reflect.reflectors.BaseReflector
      extended by net.sf.morph.reflect.reflectors.BaseBeanReflector
          extended by net.sf.morph.reflect.reflectors.ResultSetReflector
All Implemented Interfaces:
net.sf.composite.Component, BeanReflector, ContainerReflector, DecoratedReflector, Reflector, SizableReflector

public class ResultSetReflector
extends BaseBeanReflector
implements BeanReflector, ContainerReflector

Exposes the information in a ResultSet. This reflector can function both as a container reflector and as a bean reflector. When functionining a container reflector, this reflector exposes the rows in a ResultSet. As a bean reflector, this reflector exposes the column names from a particular row of a ResultSet as properties. The column names are always converted to all lowercase.

Note: Code from the getImpl(Object, String) method was taken from Spring's JdbcUtils class.

Since:
Dec 18, 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
 
Fields inherited from interface net.sf.morph.reflect.SizableReflector
IMPLICIT_PROPERTY_SIZE
 
Constructor Summary
ResultSetReflector()
           
 
Method Summary
protected  java.lang.Class getContainedTypeImpl(java.lang.Class clazz)
          Implementation of ContainerReflector.getContainedType(Class).
protected  java.lang.Object getImpl(java.lang.Object bean, java.lang.String propertyName)
          NOTE: Code copied here from Spring's JdbcUtils class.
protected  java.util.Iterator getIteratorImpl(java.lang.Object container)
          Implementation of ContainerReflector.getIterator(Object).
protected  java.lang.String[] getPropertyNamesImpl(java.lang.Object bean)
          Template method must be overridden.
protected  java.lang.Class[] getReflectableClassesImpl()
          Implementation of Reflector.getReflectableClasses().
protected  java.lang.Class getTypeImpl(java.lang.Object bean, java.lang.String propertyName)
          Template method must be overridden.
 boolean isStrictlyTyped()
          Indicates whether this reflector is strictly typed.
protected  boolean isWriteableImpl(java.lang.Object bean, java.lang.String propertyName)
          Implementation of BeanReflector.isWriteable(Object, String).
protected  void setImpl(java.lang.Object bean, java.lang.String propertyName, java.lang.Object value)
          Template method must be overridden.
 
Methods inherited from class net.sf.morph.reflect.reflectors.BaseReflector
add, addImpl, checkIndex, checkIsReflectable, createWrapperInvocationHandler, get, get, getContainedType, getImpl, getIterator, getPropertyNames, getReflectableCallCache, getReflectableClasses, getReflectorName, getSize, getSizeImpl, getType, getWrapper, getWrapperImpl, initialize, initializeImpl, isCachingIsReflectableCalls, isInitialized, isPerformingLogging, isReadable, isReadableImpl, isReflectable, isReflectable, isReflectableImpl, isReflectableImpl, isValidIndex, isWrappingRuntimeExceptions, isWriteable, newInstance, newInstanceImpl, newInstanceImpl, set, set, setCachingIsReflectableCalls, setImpl, setInitialized, setReflectableCallCache, setReflectorName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.morph.reflect.BeanReflector
get, getPropertyNames, getType, isReadable, isWriteable, set
 
Methods inherited from interface net.sf.morph.reflect.SizableReflector
getSize
 
Methods inherited from interface net.sf.morph.reflect.ContainerReflector
getContainedType, getIterator
 

Constructor Detail

ResultSetReflector

public ResultSetReflector()
Method Detail

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

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

getPropertyNamesImpl

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

Specified by:
getPropertyNamesImpl in class BaseBeanReflector
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: BaseBeanReflector
Template method must be overridden. 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).

Specified by:
getTypeImpl in class BaseBeanReflector
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

getImpl

protected java.lang.Object getImpl(java.lang.Object bean,
                                   java.lang.String propertyName)
                            throws java.lang.Exception
NOTE: Code copied here from Spring's JdbcUtils class.

Specified by:
getImpl in class BaseBeanReflector
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: BaseBeanReflector
Template method must be overridden. Implementation of BeanReflector.set(Object, String, Object). Implementation automatically provided for MutableIndexedContainerReflectors. For other reflectors, throws an UnsupportedOperationException.

Specified by:
setImpl in class BaseBeanReflector
Throws:
java.lang.Exception

getReflectableClassesImpl

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

Specified by:
getReflectableClassesImpl in class BaseReflector
Throws:
java.lang.Exception

isStrictlyTyped

public boolean isStrictlyTyped()
Description copied from class: BaseReflector
Indicates whether this reflector is strictly typed. If a reflector is strictly typed, the BaseReflector.getType(Object, String) method will throw an exception if the requested property name is not a valid property of the object. Default implementation returns false.

Overrides:
isStrictlyTyped in class BaseReflector
Returns:
false.


Copyright © 2004-2008.