public class RequiredAttributesMetacardValidator extends Object implements MetacardValidator, ReportingMetacardValidator
| Constructor and Description |
|---|
RequiredAttributesMetacardValidator(String metacardTypeName,
Set<String> requiredAttributes)
Creates a
RequiredAttributesMetacardValidator with the given metacard type name and set
of attribute names representing the required attributes. |
| Modifier and Type | Method and Description |
|---|---|
void |
validate(Metacard metacard)
Validates a
Metacard |
Optional<MetacardValidationReport> |
validateMetacard(Metacard metacard)
Validates a
Metacard. |
public RequiredAttributesMetacardValidator(String metacardTypeName, Set<String> requiredAttributes)
RequiredAttributesMetacardValidator with the given metacard type name and set
of attribute names representing the required attributes.
This validator will only validate Metacards that have the type name specified by
metacardTypeName (case-sensitive).
Any missing required attributes will be flagged as metacard-level validation errors.
metacardTypeName - the name of the metacard type this validator can validate, cannot be
nullrequiredAttributes - the names of the attributes this validator will check for, cannot be
null or emptyIllegalArgumentException - if metacardTypeName is null or if requiredAttributes is null or emptypublic void validate(Metacard metacard) throws ValidationException
MetacardValidatorMetacardvalidate in interface MetacardValidatormetacard - Metacard to validateValidationException - if any validation error occurspublic Optional<MetacardValidationReport> validateMetacard(Metacard metacard)
ReportingMetacardValidatorMetacard.validateMetacard in interface ReportingMetacardValidatormetacard - the Metacard to validate, cannot be nullOptional containing a MetacardValidationReport if there are
violations, or an empty Optional if there are no violationsThis work is licensed under a Creative Commons Attribution 4.0 International License.