public abstract class AbstractConstraint extends java.lang.Object implements Constraint
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ERR_EVALUATE_EXCEPTION |
static java.lang.String |
ERR_PROP_NOT_SET |
Constructor and Description |
---|
AbstractConstraint() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkPropertyNotNull(java.lang.String name,
java.lang.Object value)
Check that the given value is not null.
|
void |
evaluate(java.lang.Object value)
Evaluates a property value according to the implementation and initialization
parameters provided.
|
protected void |
evaluateCollection(java.util.Collection collection)
Only override if there is some specific evaluation that needs to be performed on the
collection as a whole.
|
protected abstract void |
evaluateSingleValue(java.lang.Object value)
Support for evaluation of properties.
|
java.util.Map |
getParameters()
Returns the parameters passed to the instance of the constraint.
|
java.lang.String |
getShortName()
Gets the constraint name.
|
java.lang.String |
getTitle() |
java.lang.String |
getType()
Returns the 'type' of the constraint, this is the identifier given to
constraint in the configuration.
|
void |
initialize()
Initializes the constraint with appropriate values, which will depend
on the implementation itself.
|
void |
set_shortName(java.lang.String shortName)
Deprecated.
|
void |
setRegistry(ConstraintRegistry registry)
Optionally specify the registry that will be used to register the constraint.
|
void |
setShortName(java.lang.String name)
Sets the constraint name
|
void |
setTitle(java.lang.String title) |
public static final java.lang.String ERR_PROP_NOT_SET
public static final java.lang.String ERR_EVALUATE_EXCEPTION
public void set_shortName(java.lang.String shortName)
shortName
- public void setShortName(java.lang.String name)
name
- public java.lang.String getShortName()
getShortName
in interface Constraint
public void setRegistry(ConstraintRegistry registry)
registry
- the constraint registrypublic java.lang.String getType()
Constraint
getType
in interface Constraint
public void setTitle(java.lang.String title)
public java.lang.String getTitle()
getTitle
in interface Constraint
public java.util.Map getParameters()
Constraint
getParameters
in interface Constraint
public void initialize()
Registers the constraint with the registry, if present. Call this method if you want the constraint to be auto-registered.
initialize
in interface Constraint
protected void checkPropertyNotNull(java.lang.String name, java.lang.Object value)
name
- the name of the propertyvalue
- the value to check for nullDictionaryException
- if the the property is nullpublic final void evaluate(java.lang.Object value)
Constraint
evaluate
in interface Constraint
value
- the property value to checkAbstractConstraint.evaluateSingleValue(Object)
,
AbstractConstraint.evaluateCollection(Collection)
protected void evaluateCollection(java.util.Collection collection)
collection
- the collection of values to evaluateAbstractConstraint.evaluateSingleValue(Object)
protected abstract void evaluateSingleValue(java.lang.Object value)
ConstraintException
- throw this when the evaluation failsCopyright © 2005 - 2013 Alfresco Software, Inc. All Rights Reserved.