com.uwyn.rife.site
Interface Constrained<B extends ConstrainedBean,P extends ConstrainedProperty>

All Known Implementing Classes:
CmfValidation, ContentInfo, ContentRepository, DatabaseContentInfo, Email, MetaData, RoleUser, Task, Taskoption, Validation

public interface Constrained<B extends ConstrainedBean,P extends ConstrainedProperty>

This interface defines methods for bean-centric constraining of data entities.

A constraint describes additional information about a data entity. Its main purpose is to alter the default behaviour of a data type and to clearly set the accepted limits. The meta-data that's provided through constraints can be used elsewhere to gather more information about how to correctly integrate the indicated data limits.

For example, a constraint specifies that a certain text's length is limited to 30 characters, parts of the system can query this information and act accordingly:

There are two types of constraints:

Since:
1.0
Version:
$Revision: 3717 $
Author:
Geert Bevin (gbevin[remove] at uwyn dot com)
See Also:
ConstrainedBean, ConstrainedProperty

Method Summary
 void addConstraint(B constrainedBean)
          Add a new constrained bean.
 void addConstraint(P constrainedProperty)
          Add a new constrained property.
 B getConstrainedBean()
          Retrieves the constrained bean that has been set for this Constrained instance.
 Collection<P> getConstrainedProperties()
          Returns a collection with all the constrained properties that have been registered.
 P getConstrainedProperty(String propertyName)
          Retrieve a registered ConstrainedProperty according to its name.
 boolean hasPropertyConstraint(String name)
          Indicates whether this constrained bean contains a particular constraint on at least one of its properties.
 

Method Detail

addConstraint

void addConstraint(B constrainedBean)
Add a new constrained bean.

When several constrained beans are added, they are merged at constraint-level. This means for instance that all previous unique constraints will be replaced by those of the new constrained bean, they will not be combined.

Parameters:
constrainedBean - the ConstrainedBean instance that has to be added
Since:
1.0
See Also:
ConstrainedBean

addConstraint

void addConstraint(P constrainedProperty)
Add a new constrained property.

When several of the same constrained properties are added, they are merged at constraint-level. This means for instance that a previous inList constraint will be replaced by the one of the new constrained bean, they will not be combined.

Parameters:
constrainedProperty - the ConstrainedProperty instance that has to be added
Since:
1.0
See Also:
ConstrainedProperty

getConstrainedBean

B getConstrainedBean()
Retrieves the constrained bean that has been set for this Constrained instance.

Returns:
the requested ConstrainedBean; or

null if no ConstrainedBean is available.

Since:
1.0
See Also:
ConstrainedProperty

getConstrainedProperties

Collection<P> getConstrainedProperties()
Returns a collection with all the constrained properties that have been registered.

Returns:
A Collection with all the ConstrainedProperty objects that are registered. If no constrained properties are available, an empty collection will be returned, not null.
Since:
1.0
See Also:
ConstrainedProperty

hasPropertyConstraint

boolean hasPropertyConstraint(String name)
Indicates whether this constrained bean contains a particular constraint on at least one of its properties.

Returns:
true if this constraint is present on at least one of the properties; or

false otherwise

Since:
1.6
See Also:
ConstrainedProperty

getConstrainedProperty

P getConstrainedProperty(String propertyName)
Retrieve a registered ConstrainedProperty according to its name.

Parameters:
propertyName - the name of the ConstrainedProperty that has to be retrieved
Returns:
the requested ConstrainedProperty; or

null if no such ConstrainedProperty is available.

Since:
1.0
See Also:
ConstrainedProperty


Copyright © 2001-2007 Uwyn sprl/bvba. All Rights Reserved.