public class ValidatorSuite extends Object
Validators must be stateless. The xmlObjectTarget may be the
XMLObject's element QName retrieved by XMLObject.getElementQName() or schema type, retrieved
by XMLObject.getSchemaType(), with schema type registered checks performed first.| Modifier and Type | Field and Description |
|---|---|
private String |
id
Unique ID for this suite.
|
private Logger |
log
Class logger.
|
private Map<QName,List<Validator>> |
validators
Validators registered in this suite.
|
| Constructor and Description |
|---|
ValidatorSuite(String suiteId)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
deregisterValidator(QName xmlObjectTarget,
Validator validator)
Removes a validator from this suite.
|
String |
getId()
Gets a unique ID for this suite.
|
List<Validator> |
getValidators(QName xmlObjectTarget)
Gets an immutable list of validators for a given XMLObject target.
|
private void |
performValidation(QName validatorSetKey,
XMLObject xmlObject)
Validates the given XMLObject against the validators registered under the given key.
|
private void |
performValidation(XMLObject xmlObject)
Validates the given XMLObject.
|
void |
registerValidator(QName xmlObjectTarget,
Validator validator)
Registers a new validator in the suite.
|
void |
validate(XMLObject xmlObject)
Evaluates the registered validators against the given XMLObject and it's children.
|
private final Logger log
private String id
public ValidatorSuite(String suiteId)
suiteId - unique ID for this suitepublic String getId()
public void validate(XMLObject xmlObject) throws ValidationException
xmlObject - the XMLObject to validateValidationException - thrown if the element is not validpublic List<Validator> getValidators(QName xmlObjectTarget)
xmlObjectTarget - the XMLObject the returned list of validators operates onpublic void registerValidator(QName xmlObjectTarget, Validator validator)
validator - the validatorxmlObjectTarget - the XMLObject the validator should operate onpublic void deregisterValidator(QName xmlObjectTarget, Validator validator)
xmlObjectTarget - the XMLObject the validator is currently registered forvalidator - the validator to removeprivate void performValidation(XMLObject xmlObject) throws ValidationException
xmlObject - the XMLObject to validate.ValidationException - thrown if the XMLObject does not validateprivate void performValidation(QName validatorSetKey, XMLObject xmlObject) throws ValidationException
validatorSetKey - the key to the list of validatorsxmlObject - the XMLObject to validateValidationException - thrown if any validations failCopyright © 1999-2015. All Rights Reserved.