net.sf.easyweb4j.model
Class ModelIntrospector

java.lang.Object
  extended by net.sf.easyweb4j.model.ModelIntrospector

public final class ModelIntrospector
extends Object


Constructor Summary
ModelIntrospector(Map<Class<?>,Converter> converters)
           
 
Method Summary
 boolean containsProperty(Model model, String property)
           
<T extends Model>
T
copy(T source, T destination)
          Copies all the fields from the source model to destination model.
 Object getPropertyViewValue(Model model, String property)
          Returns the actual value of the property if there are no errors on the property else returns the wrong value.
 Object readProperty(Model model, String property)
          Reads the value of the specified property/field.
 void updateProperties(Model model, Map<String,String[]> objectParameter, AssociationsProvider associationsProvider)
          Updates the values of properties/fields from the map of values.
 Object writeProperty(Model model, String property, Object value)
          Writes the value of the specified property/field.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModelIntrospector

public ModelIntrospector(Map<Class<?>,Converter> converters)
Method Detail

updateProperties

public void updateProperties(Model model,
                             Map<String,String[]> objectParameter,
                             AssociationsProvider associationsProvider)
Updates the values of properties/fields from the map of values. If mutators are specified, they are used else the fields are modified directly.

Parameters:
objectParameter - A map or property/field names to their values.
associationsProvider -

getPropertyViewValue

public Object getPropertyViewValue(Model model,
                                   String property)
Returns the actual value of the property if there are no errors on the property else returns the wrong value.

Parameters:
property - The property whose view value is to be retrieved.
Returns:
The view value of the property.

copy

public <T extends Model> T copy(T source,
                                T destination)
Copies all the fields from the source model to destination model.

Parameters:
source - The source model to copy fields from.
destination - The destination model to copy fields from.
Returns:
The destination model;

containsProperty

public boolean containsProperty(Model model,
                                String property)

readProperty

public Object readProperty(Model model,
                           String property)
                    throws InvocationTargetException,
                           IllegalAccessException
Reads the value of the specified property/field. If an accessor is specified, it is used else the field is modified directly.

Parameters:
property - The property/field whose value is to be read.
Returns:
The value of the property/field.
Throws:
InvocationTargetException
IllegalAccessException

writeProperty

public Object writeProperty(Model model,
                            String property,
                            Object value)
                     throws InvocationTargetException,
                            IllegalAccessException
Writes the value of the specified property/field. If a mutator is specified, it is used else the field is modified directly.

Parameters:
property - The property/field whose value is to be written.
Throws:
InvocationTargetException
IllegalAccessException


Copyright © 2009-2010 Chandra Sekar S. All Rights Reserved.