public abstract class AbstractConstraint extends Object implements Constraint
Modifier and Type | Field and Description |
---|---|
static String |
ERR_EVALUATE_EXCEPTION |
static String |
ERR_PROP_NOT_SET |
Constructor and Description |
---|
AbstractConstraint() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkPropertyNotNull(String name,
Object value)
Check that the given value is not null.
|
void |
evaluate(Object value)
Evaluates a property value according to the implementation and initialization
parameters provided.
|
protected void |
evaluateCollection(Collection<Object> collection)
Only override if there is some specific evaluation that needs to be performed on the
collection as a whole.
|
protected abstract void |
evaluateSingleValue(Object value)
Support for evaluation of properties.
|
Map<String,Object> |
getParameters()
Returns the parameters passed to the instance of the constraint.
|
String |
getShortName()
Gets the constraint name.
|
String |
getTitle() |
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(String shortName)
Deprecated.
|
void |
setRegistry(ConstraintRegistry registry)
Optionally specify the registry that will be used to register the constraint.
|
void |
setShortName(String name)
Sets the constraint name
|
void |
setTitle(String title) |
public static final String ERR_PROP_NOT_SET
public static final String ERR_EVALUATE_EXCEPTION
public void set_shortName(String shortName)
shortName
- Stringpublic void setShortName(String name)
name
- Stringpublic String getShortName()
getShortName
in interface Constraint
public void setRegistry(ConstraintRegistry registry)
registry
- the constraint registrypublic String getType()
Constraint
getType
in interface Constraint
public void setTitle(String title)
public String getTitle()
getTitle
in interface Constraint
public Map<String,Object> 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(String name, Object value)
name
- the name of the propertyvalue
- the value to check for nullDictionaryException
- if the the property is nullpublic final void evaluate(Object value)
Constraint
evaluate
in interface Constraint
value
- the property value to checkevaluateSingleValue(Object)
,
evaluateCollection(Collection)
protected void evaluateCollection(Collection<Object> collection)
collection
- the collection of values to evaluateevaluateSingleValue(Object)
protected abstract void evaluateSingleValue(Object value)
ConstraintException
- throw this when the evaluation failsCopyright © 2005–2016 Alfresco Software. All rights reserved.