org.apache.tapestry5.internal.services
Class BeanModelSourceImpl

java.lang.Object
  extended by org.apache.tapestry5.internal.services.BeanModelSourceImpl
All Implemented Interfaces:
BeanModelSource

public class BeanModelSourceImpl
extends Object
implements BeanModelSource


Constructor Summary
BeanModelSourceImpl(TypeCoercer typeCoercer, PropertyAccess propertyAccess, PropertyConduitSource propertyConduitSource, ClassFactory classFactory, DataTypeAnalyzer dataTypeAnalyzer, ObjectLocator locator)
           
 
Method Summary
<T> BeanModel<T>
create(Class<T> beanClass, boolean filterReadOnlyProperties, Messages messages)
          Creates a new model used for editing the indicated bean class.
<T> BeanModel<T>
createDisplayModel(Class<T> beanClass, Messages messages)
          Creates a model for display purposes; this may include properties which are read-only.
<T> BeanModel<T>
createEditModel(Class<T> beanClass, Messages messages)
          Creates a model for edit and update purposes, only properties that are fully read-write are included.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanModelSourceImpl

public BeanModelSourceImpl(TypeCoercer typeCoercer,
                           PropertyAccess propertyAccess,
                           PropertyConduitSource propertyConduitSource,
                           @ComponentLayer
                           ClassFactory classFactory,
                           @Primary
                           DataTypeAnalyzer dataTypeAnalyzer,
                           ObjectLocator locator)
Method Detail

createDisplayModel

public <T> BeanModel<T> createDisplayModel(Class<T> beanClass,
                                           Messages messages)
Description copied from interface: BeanModelSource
Creates a model for display purposes; this may include properties which are read-only.

Specified by:
createDisplayModel in interface BeanModelSource
Parameters:
beanClass - class of object to be edited
Returns:
a model containing properties that can be presented to the user

createEditModel

public <T> BeanModel<T> createEditModel(Class<T> beanClass,
                                        Messages messages)
Description copied from interface: BeanModelSource
Creates a model for edit and update purposes, only properties that are fully read-write are included.

Specified by:
createEditModel in interface BeanModelSource
Parameters:
beanClass - class of object to be edited
Returns:
a model containing properties that can be presented to the user

create

public <T> BeanModel<T> create(Class<T> beanClass,
                               boolean filterReadOnlyProperties,
                               Messages messages)
Description copied from interface: BeanModelSource
Creates a new model used for editing the indicated bean class. The model will represent all read/write properties of the bean. The order of properties is determined from the order of the getter methods in the code, and can be overridden with the ReorderProperties annotation. The labels for the properties are derived from the property names, but if the component's message catalog has keys of the form propertyName-label, then those will be used instead.

Models are mutable, so they are not cached, a fresh instance is created each time.

Specified by:
create in interface BeanModelSource
Parameters:
beanClass - class of object to be edited
filterReadOnlyProperties - if true, then properties that are read-only will be skipped (leaving only read-write properties, appropriate for BeanEditForm, etc.). If false, then both read-only and read-write properties will be included (appropriate for Grid or BeanDisplay).
messages - Used to find explicit overrides of
Returns:
a model


Copyright © 2003-2012 The Apache Software Foundation.