public class ValueConstraint extends Object
Constructor and Description |
---|
ValueConstraint(String value,
String expr)
create constraint: field value matches with the given string expression
|
Modifier and Type | Method and Description |
---|---|
boolean |
matches(Object value)
match with the given
Object value. |
void |
setCacheOnMatch(boolean cacheOnMatch)
set whether to cache if there was a match
|
void |
setCacheOnMatchFailure(boolean cacheOnMatchFailure)
set whether to cache if there was a failure to match
|
void |
setMatchExpr(int expr)
set field matching expression
|
void |
setMaxValue(float value)
set the maximum value
|
void |
setMinValue(float value)
set minimum value
|
void |
setValue(String value)
set value for this constraint
|
String |
toString() |
public ValueConstraint(String value, String expr) throws IllegalArgumentException
value
- specific value to matchexpr
- match expressionIllegalArgumentException
public void setValue(String value)
value
- specific value to matchpublic void setMinValue(float value)
value
- minimum valuepublic void setMaxValue(float value)
value
- maximum valuepublic void setMatchExpr(int expr)
expr
- match expressionpublic void setCacheOnMatch(boolean cacheOnMatch)
cacheOnMatch
- should the field value match, enable cache?public void setCacheOnMatchFailure(boolean cacheOnMatchFailure)
cacheOnMatchFailure
- should the field value doesn't match,
enable cache?public boolean matches(Object value)
Object
value.true
if the value passes the constraint,
false
otherwise.Copyright © 2021. All rights reserved.