|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.alfresco.repo.dictionary.constraint.AbstractConstraint
org.alfresco.repo.dictionary.constraint.RegexConstraint
public class RegexConstraint
Constraint implementation that performs regular expression comparisons.
Where possible, the type converter
will be used to first convert the value to a String
, so the evaluation
will be against the value's String
equivalent.
The failure condition can be changed to occur either on a match or on a non-match by using
the requiresMatch
property. The default is true, i.e.
failures will occur if the object value does not match the given expression.
String.matches(java.lang.String)
,
Pattern
Field Summary | |
---|---|
static java.lang.String |
CONSTRAINT_REGEX_MATCH
|
static java.lang.String |
CONSTRAINT_REGEX_MSG_PREFIX
|
static java.lang.String |
CONSTRAINT_REGEX_NO_MATCH
|
Fields inherited from class org.alfresco.repo.dictionary.constraint.AbstractConstraint |
---|
ERR_EVALUATE_EXCEPTION, ERR_PROP_NOT_SET |
Constructor Summary | |
---|---|
RegexConstraint()
|
Method Summary | |
---|---|
protected void |
evaluateSingleValue(java.lang.Object value)
Support for evaluation of properties. |
java.lang.String |
getExpression()
|
java.util.Map |
getParameters()
Returns the parameters passed to the instance of the constraint. |
boolean |
getRequiresMatch()
|
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 |
setExpression(java.lang.String expression)
Set the regular expression used to evaluate String values |
void |
setRequiresMatch(boolean requiresMatch)
Set whether the regular expression must be matched or not |
java.lang.String |
toString()
|
Methods inherited from class org.alfresco.repo.dictionary.constraint.AbstractConstraint |
---|
checkPropertyNotNull, evaluate, evaluateCollection, getShortName, getTitle, set_shortName, setRegistry, setShortName, setTitle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String CONSTRAINT_REGEX_NO_MATCH
public static final java.lang.String CONSTRAINT_REGEX_MATCH
public static final java.lang.String CONSTRAINT_REGEX_MSG_PREFIX
Constructor Detail |
---|
public RegexConstraint()
Method Detail |
---|
public java.lang.String getType()
getType
in interface Constraint
getType
in class AbstractConstraint
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getExpression()
String.matches(java.lang.String)
public void setExpression(java.lang.String expression)
regular
- expression similar to the String.matches(java.lang.String)
argumentpublic boolean getRequiresMatch()
public void setRequiresMatch(boolean requiresMatch)
requiresMatch
- Set to true if the value must match the regular expression
or false if the value must not match the regular expressionpublic java.util.Map getParameters()
Constraint
getParameters
in interface Constraint
getParameters
in class AbstractConstraint
public void initialize()
AbstractConstraint
Registers the constraint with the registry, if present. Call this method if you want the constraint to be auto-registered.
initialize
in interface Constraint
initialize
in class AbstractConstraint
protected void evaluateSingleValue(java.lang.Object value)
AbstractConstraint
evaluateSingleValue
in class AbstractConstraint
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |