Class BeanModelImpl<T>
- java.lang.Object
-
- org.apache.tapestry5.beanmodel.internal.beanmodel.BeanModelImpl<T>
-
- All Implemented Interfaces:
BeanModel<T>
public class BeanModelImpl<T> extends java.lang.Object implements BeanModel<T>
-
-
Constructor Summary
Constructors Constructor Description BeanModelImpl(java.lang.Class<T> beanType, PropertyConduitSource propertyConduitSource, TypeCoercer typeCoercer, Messages messages, ObjectLocator locator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PropertyModeladd(java.lang.String propertyName)Adds a new property to the model, returning its mutable model for further refinement.PropertyModeladd(java.lang.String propertyName, PropertyConduit conduit)Adds a new, synthetic property to the model, returning its mutable model for further refinement.PropertyModeladd(RelativePosition position, java.lang.String existingPropertyName, java.lang.String propertyName)Adds a new property to the model (as withBeanModel.add(String)), ordered before or after an existing property.PropertyModeladd(RelativePosition position, java.lang.String existingPropertyName, java.lang.String propertyName, PropertyConduit conduit)Adds a new property to the model, ordered before or after an existing property.PropertyModeladdEmpty(java.lang.String propertyName)Adds an empty property (one with no property conduit).PropertyModeladdExpression(java.lang.String propertyName, java.lang.String expression)Adds a new synthetic property to the model, returning its mutable model for further refinement.BeanModel<T>exclude(java.lang.String... propertyNames)Removes the named properties from the model, if present.PropertyModelget(java.lang.String propertyName)Returns the named model.java.lang.Class<T>getBeanType()Returns the type of bean for which this model was initially created.PropertyModelgetById(java.lang.String propertyId)Returns the identified model.java.util.List<java.lang.String>getPropertyNames()Returns a list of the editable properties of the bean, in presentation order.BeanModel<T>include(java.lang.String... propertyNames)Re-orders the properties of the model into the specified order.TnewInstance()Creates a new bean instance.BeanModel<T>reorder(java.lang.String... propertyNames)Re-orders the properties of the model into the specified order.java.lang.StringtoString()
-
-
-
Constructor Detail
-
BeanModelImpl
public BeanModelImpl(java.lang.Class<T> beanType, PropertyConduitSource propertyConduitSource, TypeCoercer typeCoercer, Messages messages, ObjectLocator locator)
-
-
Method Detail
-
getBeanType
public java.lang.Class<T> getBeanType()
Description copied from interface:BeanModelReturns the type of bean for which this model was initially created.- Specified by:
getBeanTypein interfaceBeanModel<T>
-
newInstance
public T newInstance()
Description copied from interface:BeanModelCreates a new bean instance. This is based onObjectLocator.autobuild(Class), so a public constructor will be used, and dependencies injected.- Specified by:
newInstancein interfaceBeanModel<T>- Returns:
- new instance of the bean
-
add
public PropertyModel add(java.lang.String propertyName)
Description copied from interface:BeanModelAdds 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. The property must be real (but may have been excluded if there was no datatype associated with the property). To add a synthetic property, useBeanModel.add(String, org.apache.tapestry5.beanmodel.PropertyConduit)
-
addEmpty
public PropertyModel addEmpty(java.lang.String propertyName)
Description copied from interface:BeanModelAdds an empty property (one with no property conduit).
-
addExpression
public PropertyModel addExpression(java.lang.String propertyName, java.lang.String expression)
Description copied from interface:BeanModelAdds a new synthetic 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:
addExpressionin interfaceBeanModel<T>- Parameters:
propertyName- name of property to addexpression- expression for the property- Returns:
- the new property model (for further configuration)
-
add
public PropertyModel add(RelativePosition position, java.lang.String existingPropertyName, java.lang.String propertyName, PropertyConduit conduit)
Description copied from interface:BeanModelAdds a new property to the model, ordered before or after an existing property.- Specified by:
addin interfaceBeanModel<T>- Parameters:
position- controls whether the new property is ordered before or after the existing propertyexistingPropertyName- the name of an existing property (this must exist)propertyName- the new property to addconduit- 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, java.lang.String existingPropertyName, java.lang.String propertyName)
Description copied from interface:BeanModelAdds a new property to the model (as withBeanModel.add(String)), ordered before or after an existing property.- Specified by:
addin interfaceBeanModel<T>- Parameters:
position- controls whether the new property is ordered before or after the existing propertyexistingPropertyName- 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(java.lang.String propertyName, PropertyConduit conduit)
Description copied from interface:BeanModelAdds a new, synthetic property to the model, returning its mutable model for further refinement.- Specified by:
addin interfaceBeanModel<T>- Parameters:
propertyName- name of property to addconduit- the conduit used to read or update the property; this may be null for a synthetic or placeholder property. Instead of passing null, please invokeBeanModel.addEmpty(String).- Returns:
- the model for the property
- See Also:
BeanModel.addExpression(String, String)
-
get
public PropertyModel get(java.lang.String propertyName)
Description copied from interface:BeanModelReturns the named model.
-
getById
public PropertyModel getById(java.lang.String propertyId)
Description copied from interface:BeanModelReturns the identified model. Property ids are a stripped version of the property name. Case is ignored.- Specified by:
getByIdin interfaceBeanModel<T>- Parameters:
propertyId- matched caselessly againstPropertyModel.getId()
-
getPropertyNames
public java.util.List<java.lang.String> getPropertyNames()
Description copied from interface:BeanModelReturns a list of the editable properties of the bean, in presentation order.- Specified by:
getPropertyNamesin interfaceBeanModel<T>
-
exclude
public BeanModel<T> exclude(java.lang.String... propertyNames)
Description copied from interface:BeanModelRemoves the named properties from the model, if present. It is not considered an error to remove a property that does not exist.
-
reorder
public BeanModel<T> reorder(java.lang.String... propertyNames)
Description copied from interface:BeanModelRe-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.
-
include
public BeanModel<T> include(java.lang.String... propertyNames)
Description copied from interface:BeanModelRe-orders the properties of the model into the specified order. Existing properties that are not indicated are removed.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-