Adds the given Constraint for the given element in the
map maintained by this object. This maps maintains Constraint lists for
each of the elements of the Corresponding Validatee.
param
element the element for which the given
constraint to be added to its list
param
constraint the given Constraint to be added
to the list of Constraints of the given element.
ArrayList list = (ArrayList) elementToConstraints.get(element);
if(null == list) {
list = new ArrayList();
}
list.add(constraint);
elementToConstraints.put(element, list);
Validates the given element. The given element is a scalar element.
param
elementName the element to be validated
param
elementDtdName the dtd name of the element to be validated
param
validatee the Validatee object that this object
corresponds to.
return
Collection the Collection of
ConstraintFailure Objects. Collection is empty
if there are no failures.
//This method --fetches the value of the specified element
// --fetches the constraint list for the specified element
// --applies the constraints to the specified element
ArrayList failures = new ArrayList();
ArrayList constraintList =
(ArrayList)elementToConstraints.get(elementDtdName);
String name = validatee.getXPath() + Constants.XPATH_DELIMITER +
elementDtdName;
if(constraintList != null) {
String property = (String)validatee.getElement(elementName);
failures.addAll(validate(property, constraintList, name));
} else {
///String format =
/// BundleReader.getValue("MSG_No_definition_for"); //NOI18N
/// Object[] arguments = new Object[]{"Constraints", name}; //NOI18N
///System.out.println(MessageFormat.format(format, arguments));
}
return failures;