org.directwebremoting.hibernate
Class H3BeanConverter

java.lang.Object
  extended by org.directwebremoting.convert.BaseV20Converter
      extended by org.directwebremoting.convert.BasicObjectConverter
          extended by org.directwebremoting.convert.BeanConverter
              extended by org.directwebremoting.hibernate.H3BeanConverter
All Implemented Interfaces:
Converter, NamedConverter

public class H3BeanConverter
extends BeanConverter
implements Converter

BeanConverter that works with Hibernate to get BeanInfo.

Author:
Joe Walker [joe at getahead dot ltd dot uk]

Field Summary
protected  boolean assumeSession
          Do we assume there is an open session and read properties?
protected  java.util.Map methods
          The cache of method lookups that we've already done
 
Fields inherited from class org.directwebremoting.convert.BasicObjectConverter
converterManager, exclusions, inclusions, instanceType, javascript
 
Constructor Summary
H3BeanConverter()
           
 
Method Summary
protected  java.lang.reflect.Method findGetter(java.lang.Object data, java.lang.String property)
          Cache the method if possible, using the classname and property name to allow for similar named methods.
 java.lang.Class getClass(java.lang.Object example)
          Hibernate makes Object.getClass() diffficult ...
 java.util.Map getPropertyMapFromObject(java.lang.Object example, boolean readRequired, boolean writeRequired)
          Get a map of property names to implementations of Property.
 void setAssumeSession(boolean assumeSession)
           
 
Methods inherited from class org.directwebremoting.convert.BeanConverter
createTypeHintContext, getPropertyMapFromClass
 
Methods inherited from class org.directwebremoting.convert.BasicObjectConverter
convertInbound, convertOutbound, extractInboundTokens, getConverterManager, getInstanceType, getJavascript, isAllowedByIncludeExcludeRules, setConverterManager, setExclude, setImplementation, setInclude, setInstanceType, setJavascript
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.directwebremoting.extend.Converter
convertInbound, convertOutbound, setConverterManager
 

Field Detail

assumeSession

protected boolean assumeSession
Do we assume there is an open session and read properties?


methods

protected final java.util.Map methods
The cache of method lookups that we've already done

GuardedBy("self") for iteration and compound actions

Constructor Detail

H3BeanConverter

public H3BeanConverter()
Method Detail

getPropertyMapFromObject

public java.util.Map getPropertyMapFromObject(java.lang.Object example,
                                              boolean readRequired,
                                              boolean writeRequired)
                                       throws MarshallException
Description copied from interface: NamedConverter
Get a map of property names to implementations of Property.

HibernateBeanConverter (and maybe others) may want to provide alternate versions of bean.getClass(), and we may wish to fake or hide properties in some cases.

This implementation is preferred above the alternate: NamedConverter.getPropertyMapFromClass(Class, boolean, boolean) because it potentially retains important extra type information.

Specified by:
getPropertyMapFromObject in interface NamedConverter
Overrides:
getPropertyMapFromObject in class BeanConverter
Parameters:
example - The object to find bean info from
readRequired - The properties returned must be readable
writeRequired - The properties returned must be writeable
Returns:
An array of PropertyDescriptors describing the beans properties
Throws:
MarshallException - If the introspection fails
See Also:
NamedConverter.getPropertyMapFromClass(Class, boolean, boolean)

getClass

public java.lang.Class getClass(java.lang.Object example)
Hibernate makes Object.getClass() diffficult ...

Parameters:
example - The class that we want to call Object.getClass() on
Returns:
The type of the given object

findGetter

protected java.lang.reflect.Method findGetter(java.lang.Object data,
                                              java.lang.String property)
                                       throws java.beans.IntrospectionException
Cache the method if possible, using the classname and property name to allow for similar named methods.

Parameters:
data - The bean to introspect
property - The property to get the accessor for
Returns:
The getter method
Throws:
java.beans.IntrospectionException

setAssumeSession

public void setAssumeSession(boolean assumeSession)
Parameters:
assumeSession - the assumeSession to set