com.uwyn.rife.site
Class ConstrainedBean<T extends ConstrainedBean>
java.lang.Object
com.uwyn.rife.site.ConstrainedBean<T>
public class ConstrainedBean<T extends ConstrainedBean>
- extends Object
A ConstrainedBean object makes it possible to define all
constraints for a bean instance that are not related to a single property.
The constraints here are global for the entire bean and either involve
several properties or are even totally unrelated to properties.
It's possible to add constraints to a ConstrainedProperty instance
through regular setters, but chainable setters are also available to make
it possible to easily define a series of constraints, for example:
ConstrainedBean constrained = new ConstrainedBean()
.unique("firstName", "lastName")
.defaultOrder("city")
.defaultOrder("lastName")
.defaultOrder("firstName");
A constrained bean is typically added to a Constrained bean in
its constructor. These are the static constraints that will be set for each
and every instance of the bean. You'll however most of the time use the
Validation abstract class that provides the activateValidation method which initializes
the constraints on a need-to-have basis. This dramatically reduces memory
usage since otherwise all constraints will be initialized for every bean
instance, even though you don't use them.
- Since:
- 1.0
- Version:
- $Revision: 3669 $
- Author:
- Geert Bevin (gbevin[remove] at uwyn dot com)
- See Also:
Constrained,
ConstrainedProperty
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ASC
public static final ConstrainedBean.Direction ASC
DESC
public static final ConstrainedBean.Direction DESC
ASSOCIATIONS
public static final String ASSOCIATIONS
- See Also:
- Constant Field Values
UNIQUE
public static final String UNIQUE
- See Also:
- Constant Field Values
TEXTUAL_IDENTIFIER
public static final String TEXTUAL_IDENTIFIER
- See Also:
- Constant Field Values
DEFAULT_ORDERING
public static final String DEFAULT_ORDERING
- See Also:
- Constant Field Values
mConstraints
protected HashMap<String,Object> mConstraints
ConstrainedBean
public ConstrainedBean()
- Creates a new
ConstrainedBean.
- Since:
- 1.0
associations
public T associations(Class... associations)
setAssociations
public void setAssociations(Class... associations)
getAssociations
public Class[] getAssociations()
hasAssociations
public boolean hasAssociations()
unique
public T unique(String... unique)
uniques
public T uniques(List<String[]> unique)
setUniques
public void setUniques(List<String[]> unique)
getUniques
public List<String[]> getUniques()
hasUniques
public boolean hasUniques()
textualIdentifier
public T textualIdentifier(TextualIdentifierGenerator identifier)
setTextualIdentifier
public void setTextualIdentifier(TextualIdentifierGenerator identifier)
getTextualIdentifier
public TextualIdentifierGenerator getTextualIdentifier()
hasTextualIdentifier
public boolean hasTextualIdentifier()
defaultOrder
public T defaultOrder(String propertyName)
defaultOrder
public T defaultOrder(String propertyName,
ConstrainedBean.Direction direction)
defaultOrder
public T defaultOrder(ConstrainedBean.Order order)
defaultOrdering
public T defaultOrdering(List<ConstrainedBean.Order> ordering)
setDefaultOrdering
public void setDefaultOrdering(List<ConstrainedBean.Order> ordering)
getDefaultOrdering
public List<ConstrainedBean.Order> getDefaultOrdering()
hasDefaultOrdering
public boolean hasDefaultOrdering()
Copyright © 2001-2007 Uwyn sprl/bvba. All Rights Reserved.