public final class PropertyValidator extends Object implements Validator<Property>
Modifier and Type | Field and Description |
---|---|
static String |
ASSERT_NONE_MESSAGE |
static String |
ASSERT_ONE_MESSAGE |
static String |
ASSERT_ONE_OR_LESS_MESSAGE |
static String |
ASSERT_ONE_OR_MORE_MESSAGE |
Constructor and Description |
---|
PropertyValidator(List<ValidationRule> rules) |
Modifier and Type | Method and Description |
---|---|
static void |
assertNone(String propertyName,
PropertyList properties)
Ensure a property doesn't occur in the specified list.
|
static void |
assertOne(String propertyName,
PropertyList properties)
Ensure a property occurs once.
|
static void |
assertOneOrLess(String propertyName,
PropertyList properties)
Ensure a property occurs no more than once.
|
static void |
assertOneOrMore(String propertyName,
PropertyList properties)
Ensure a property occurs at least once.
|
void |
validate(Property target)
Validates the associated model against an applicable standard.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
assertFalse
public static final String ASSERT_NONE_MESSAGE
public static final String ASSERT_ONE_OR_LESS_MESSAGE
public static final String ASSERT_ONE_MESSAGE
public static final String ASSERT_ONE_OR_MORE_MESSAGE
public PropertyValidator(List<ValidationRule> rules)
public void validate(Property target) throws ValidationException
Validator
validate
in interface Validator<Property>
ValidationException
- where the model does not confirm to the applicable standardpublic static void assertOneOrLess(String propertyName, PropertyList properties) throws ValidationException
propertyName
- the property nameproperties
- a list of properties to queryValidationException
- when the specified property occurs more than oncepublic static void assertOneOrMore(String propertyName, PropertyList properties) throws ValidationException
propertyName
- the property nameproperties
- a list of properties to queryValidationException
- when the specified property occurs more than oncepublic static void assertOne(String propertyName, PropertyList properties) throws ValidationException
propertyName
- the property nameproperties
- a list of properties to queryValidationException
- when the specified property does not occur oncepublic static void assertNone(String propertyName, PropertyList properties) throws ValidationException
propertyName
- the name of a propertyproperties
- a list of propertiesValidationException
- thrown when the specified property
is found in the list of properties