org.apache.tapestry.internal.beaneditor
Class BeanModelImpl<T>

java.lang.Object
  extended by org.apache.tapestry.internal.beaneditor.BeanModelImpl<T>
All Implemented Interfaces:
BeanModel<T>

public class BeanModelImpl<T>
extends Object
implements BeanModel<T>


Constructor Summary
BeanModelImpl(Class<T> beanType, PropertyConduitSource propertyConduitSource, TypeCoercer typeCoercer, Messages messages, ObjectLocator locator)
           
 
Method Summary
 PropertyModel add(RelativePosition position, String existingPropertyName, String propertyName)
          Adds a new property to the model, ordered before or after an existing property.
 PropertyModel add(RelativePosition position, String existingPropertyName, String propertyName, PropertyConduit conduit)
          Adds a new property to the model, ordered before or after an existing property.
 PropertyModel add(String propertyName)
          Adds a new property to the model, returning its mutable model for further refinement.
 PropertyModel add(String propertyName, PropertyConduit conduit)
          Adds a new property to the model, returning its mutable model for further refinement.
 BeanModel exclude(String... propertyNames)
          Removes the named properties from the model, if present.
 PropertyModel get(String propertyName)
          Returns the named model.
 Class<T> getBeanType()
          Returns the type of bean for which this model was initially created.
 PropertyModel getById(String propertyId)
          Returns the identified model.
 List<String> getPropertyNames()
          Returns a list of the editable properties of the bean, in presentation order.
 BeanModel include(String... propertyNames)
          Re-orders the properties of the model into the specified order.
 T newInstance()
          Creates a new bean instance.
 BeanModel reorder(String... propertyNames)
          Re-orders the properties of the model into the specified order.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BeanModelImpl

public BeanModelImpl(Class<T> beanType,
                     PropertyConduitSource propertyConduitSource,
                     TypeCoercer typeCoercer,
                     Messages messages,
                     ObjectLocator locator)
Method Detail

getBeanType

public Class<T> getBeanType()
Description copied from interface: BeanModel
Returns the type of bean for which this model was initially created.

Specified by:
getBeanType in interface BeanModel<T>

newInstance

public T newInstance()
Description copied from interface: BeanModel
Creates a new bean instance. This is based on ObjectLocator.autobuild(Class), so a public constructor will be used, and dependencies injected.

Specified by:
newInstance in interface BeanModel<T>
Returns:
new instance of the bean

add

public PropertyModel add(String propertyName)
Description copied from interface: BeanModel
Adds a new property to the model, returning its mutable model for further refinement. The property is added to the end of the list of properties.

Specified by:
add in interface BeanModel<T>
Parameters:
propertyName - name of property to add
Returns:
the new property model (for further configuration)

add

public PropertyModel add(RelativePosition position,
                         String existingPropertyName,
                         String propertyName,
                         PropertyConduit conduit)
Description copied from interface: BeanModel
Adds a new property to the model, ordered before or after an existing property.

Specified by:
add in interface BeanModel<T>
Parameters:
position - controls whether the new property is ordered before or after the existing property
existingPropertyName - the name of an existing property (this must exist)
propertyName - the new property to add
conduit - conduit used to read or update the property; this may be null for a synthetic or placeholder property
Returns:
the new property model (for further configuration)

add

public PropertyModel add(RelativePosition position,
                         String existingPropertyName,
                         String propertyName)
Description copied from interface: BeanModel
Adds a new property to the model, ordered before or after an existing property.

Specified by:
add in interface BeanModel<T>
Parameters:
position - controls whether the new property is ordered before or after the existing property
existingPropertyName - the name of an existing property (this must exist)
propertyName - the new property to add
Returns:
the new property model (for further configuration)

add

public PropertyModel add(String propertyName,
                         PropertyConduit conduit)
Description copied from interface: BeanModel
Adds a new property to the model, returning its mutable model for further refinement.

Specified by:
add in interface BeanModel<T>
Parameters:
propertyName - name of property to add
conduit - the conduit used to read or update the property; this may be null for a synthetic or placeholder property
Returns:
the model for the property

get

public PropertyModel get(String propertyName)
Description copied from interface: BeanModel
Returns the named model.

Specified by:
get in interface BeanModel<T>
Parameters:
propertyName - name of property to retrieve model for (case is ignored)
Returns:
the model for the property

getById

public PropertyModel getById(String propertyId)
Description copied from interface: BeanModel
Returns the identified model. Property ids are a stripped version of the property name. Case is ignored.

Specified by:
getById in interface BeanModel<T>
Parameters:
propertyId - matched caselessly against PropertyModel.getId()

getPropertyNames

public List<String> getPropertyNames()
Description copied from interface: BeanModel
Returns a list of the editable properties of the bean, in presentation order.

Specified by:
getPropertyNames in interface BeanModel<T>

exclude

public BeanModel exclude(String... propertyNames)
Description copied from interface: BeanModel
Removes the named properties from the model, if present. It is not considered an error to remove a property that does not exist.

Specified by:
exclude in interface BeanModel<T>
Parameters:
propertyNames - the names of properties to be removed (case insensitive)
Returns:
the model for further modifications

reorder

public BeanModel reorder(String... propertyNames)
Description copied from interface: BeanModel
Re-orders the properties of the model into the specified order. Existing properties that are not indicated are retained, but ordered to the end of the list.

Specified by:
reorder in interface BeanModel<T>
Parameters:
propertyNames - property names in order they should be displayed (case insensitive)
Returns:
the model for further modifications

include

public BeanModel include(String... propertyNames)
Description copied from interface: BeanModel
Re-orders the properties of the model into the specified order. Existing properties that are not indicated are <>.

Specified by:
include in interface BeanModel<T>
Parameters:
propertyNames - the names of properties to be retained
Returns:
the model for further modifications

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.