public class ListOfValuesConstraint extends AbstractConstraint
setAllowedValues(List)
,
setCaseSensitive(boolean)
Modifier and Type | Field and Description |
---|---|
static String |
ALLOWED_VALUES_PARAM |
static String |
CASE_SENSITIVE_PARAM |
protected boolean |
caseSensitive |
static String |
CONSTRAINT_TYPE |
protected boolean |
sorted |
static String |
SORTED_PARAM |
ERR_EVALUATE_EXCEPTION, ERR_PROP_NOT_SET
Constructor and Description |
---|
ListOfValuesConstraint() |
Modifier and Type | Method and Description |
---|---|
protected void |
evaluateSingleValue(Object value)
Support for evaluation of properties.
|
List<String> |
getAllowedValues()
Get the allowed values.
|
String |
getDisplayLabel(String constraintAllowableValue,
MessageLookup messageLookup)
Get the display label for the specified allowable value in this constraint.
|
Map<String,Object> |
getParameters()
Returns the parameters passed to the instance of the constraint.
|
protected List<String> |
getRawAllowedValues()
Get the allowed values.
|
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.
|
boolean |
isCaseSensitive() |
boolean |
isSorted()
Indicates whether the list of values are sorted or not.
|
void |
setAllowedValues(List<String> allowedValues)
Set the values that are allowed by the constraint.
|
void |
setCaseSensitive(boolean caseSensitive)
Set the handling of case checking.
|
void |
setSorted(boolean sorted)
Set whether the values are ordered or not.
|
String |
toString() |
checkPropertyNotNull, evaluate, evaluateCollection, getShortName, getTitle, set_shortName, setRegistry, setShortName, setTitle
public static final String CONSTRAINT_TYPE
public static final String CASE_SENSITIVE_PARAM
public static final String ALLOWED_VALUES_PARAM
public static final String SORTED_PARAM
protected boolean caseSensitive
protected boolean sorted
public String getType()
getType
in interface Constraint
getType
in class AbstractConstraint
public List<String> getAllowedValues()
protected List<String> getRawAllowedValues()
public String getDisplayLabel(String constraintAllowableValue, MessageLookup messageLookup)
"listconstraint." + constraintName + "." + constraintAllowableValue. e.g. listconstraint.test_listConstraintOne.VALUE_ONE.This key is then used to look up a properties bundle for the localised display label. Spaces are allowed in the keys, but they should be escaped in the properties file as follows:
listconstraint.test_listConstraintOne.VALUE\ WITH\ SPACES=Display label
constraintAllowableValue
- StringmessageLookup
- MessageLookupnull
.I18NUtil.getLocale()
public void setAllowedValues(List<String> allowedValues)
allowedValues
- a list of allowed valuespublic boolean isCaseSensitive()
public void setCaseSensitive(boolean caseSensitive)
caseSensitive
- true if the constraint is case-sensitive (default),
or false for case-insensitive.public boolean isSorted()
public void setSorted(boolean sorted)
sorted
- true if sorted, false otherwisepublic 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
AbstractConstraint.initialize()
public Map<String,Object> getParameters()
Constraint
getParameters
in interface Constraint
getParameters
in class AbstractConstraint
AbstractConstraint.getParameters()
protected void evaluateSingleValue(Object value)
AbstractConstraint
evaluateSingleValue
in class AbstractConstraint
AbstractConstraint.evaluateSingleValue(java.lang.Object)
Copyright © 2005–2018 Alfresco Software. All rights reserved.