public final class PropertyValidator extends java.lang.Object implements Validator<Property>
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ASSERT_NONE_MESSAGE |
static java.lang.String |
ASSERT_ONE_MESSAGE |
static java.lang.String |
ASSERT_ONE_OR_LESS_MESSAGE |
static java.lang.String |
ASSERT_ONE_OR_MORE_MESSAGE |
| Constructor and Description |
|---|
PropertyValidator(java.util.List<ValidationRule> rules) |
| Modifier and Type | Method and Description |
|---|---|
static void |
assertNone(java.lang.String propertyName,
PropertyList properties)
Ensure a property doesn't occur in the specified list.
|
static void |
assertOne(java.lang.String propertyName,
PropertyList properties)
Ensure a property occurs once.
|
static void |
assertOneOrLess(java.lang.String propertyName,
PropertyList properties)
Ensure a property occurs no more than once.
|
static void |
assertOneOrMore(java.lang.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, waitassertFalsepublic static final java.lang.String ASSERT_NONE_MESSAGE
public static final java.lang.String ASSERT_ONE_OR_LESS_MESSAGE
public static final java.lang.String ASSERT_ONE_MESSAGE
public static final java.lang.String ASSERT_ONE_OR_MORE_MESSAGE
public PropertyValidator(java.util.List<ValidationRule> rules)
public void validate(Property target) throws ValidationException
Validatorvalidate in interface Validator<Property>ValidationException - where the model does not confirm to the applicable standardpublic static void assertOneOrLess(java.lang.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(java.lang.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(java.lang.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(java.lang.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