org.directwebremoting.convert
Class ObjectConverter

java.lang.Object
  extended by org.directwebremoting.convert.BasicObjectConverter
      extended by org.directwebremoting.convert.ObjectConverter
All Implemented Interfaces:
Converter, NamedConverter

public class ObjectConverter
extends BasicObjectConverter

Convert a Javascript associative array into a JavaBean

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

Constructor Summary
ObjectConverter()
           
 
Method Summary
 java.util.Map<java.lang.String,Property> getPropertyMapFromClass(java.lang.Class<?> type, boolean readRequired, boolean writeRequired)
          Get a map of property names to implementations of Property.
 java.util.Map<java.lang.String,Property> getPropertyMapFromObject(java.lang.Object example, boolean readRequired, boolean writeRequired)
          Get a map of property names to implementations of Property.
 void setForce(java.lang.String force)
          Do we force accessibility for private fields
 
Methods inherited from class org.directwebremoting.convert.BasicObjectConverter
convertInbound, convertOutbound, getConverterManager, getInstanceType, getJavascript, getJavascriptSuperClass, setConstructor, setConverterManager, setExclude, setImplementation, setInclude, setInstanceType, setJavascript, setJavascriptSuperClass
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectConverter

public ObjectConverter()
Method Detail

setForce

public void setForce(java.lang.String force)
Do we force accessibility for private fields

Parameters:
force - "true|false" to set the force accessibility flag

getPropertyMapFromObject

public java.util.Map<java.lang.String,Property> getPropertyMapFromObject(java.lang.Object example,
                                                                         boolean readRequired,
                                                                         boolean writeRequired)
                                                                  throws ConversionException
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.

Parameters:
example - The object to find bean info from
readRequired - The properties returned must be readable
writeRequired - The properties returned must be writable
Returns:
An array of PropertyDescriptors describing the beans properties
Throws:
ConversionException - If the introspection fails
See Also:
NamedConverter.getPropertyMapFromClass(Class, boolean, boolean)

getPropertyMapFromClass

public java.util.Map<java.lang.String,Property> getPropertyMapFromClass(java.lang.Class<?> type,
                                                                        boolean readRequired,
                                                                        boolean writeRequired)
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.

If you have a real object to investigate then it is probably better to call NamedConverter.getPropertyMapFromObject(Object, boolean, boolean) because that version can take into account extra runtime type info.

Parameters:
type - The class to find bean info from
readRequired - The properties returned must be readable
writeRequired - The properties returned must be writable
Returns:
An array of PropertyDescriptors describing the beans properties
See Also:
NamedConverter.getPropertyMapFromObject(Object, boolean, boolean)

Copyright 2008