MandatoryConstraintpublic class MandatoryConstraint extends ConstraintUtils implements ConstraintMandatoryConstraint is a {@link Constraint} to validate non-null objects.
It implements Constraint interface and extends
{@link ConstraintUtils} class.
match method of this object returns empty
Collection if the value/object being validated is non
null ; else it returns a Collection with a
{@link ConstraintFailure} object in it. ConstraintUtils class
provides utility methods for formating failure messages and a
print method to print this object. |
Constructors Summary |
---|
public MandatoryConstraint()Creates a new instance of MandatoryConstraint .
|
Methods Summary |
---|
public java.util.Collection | match(java.lang.String value, java.lang.String name)Validates the given value against this Constraint .
return match((Object)value, name);
| public java.util.Collection | match(java.lang.Object value, java.lang.String name)Validates the given value against this Constraint .
Collection failed_constrained_list = new ArrayList();
if (null == value){
String failureMessage = formatFailureMessage(toString(), name);
failed_constrained_list.add(new ConstraintFailure(toString(), value,
name, failureMessage, BundleReader.getValue(
"MSG_MandatoryConstraint_Failure"))); //NOI18N
}
return failed_constrained_list;
|
|