Package org.apache.sis.feature
Class Validator
java.lang.Object
org.apache.sis.feature.Validator
Provides validation methods to be shared by different implementations.
- Since:
- 0.5
- Version:
- 0.7
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final DefaultDataQualityThe data quality report. -
Constructor Summary
ConstructorsConstructorDescriptionValidator(org.opengis.metadata.maintenance.ScopeCode scope) Creates a new validator. -
Method Summary
Modifier and TypeMethodDescriptionprivate AbstractElementaddViolationReport(AbstractElement report, AbstractIdentifiedType type, org.opengis.util.InternationalString explanation) Adds a report for a constraint violation.private static Collection<?>Wraps singleton value in a collection for processing byvalidate(…)methods.(package private) voidvalidate(DefaultAssociationRole role, Collection<?> values) Verifies if the given value is valid for the given association role.(package private) voidvalidate(DefaultAttributeType<?> type, Collection<?> values) Verifies if the given values are valid for the given attribute type.(package private) voidvalidate(FeatureType type, AbstractFeature feature) Implementation ofAbstractFeature.quality(), also shared byFeaturesstatic method.(package private) voidvalidateAny(AbstractIdentifiedType type, Object value) Verifies if the given value is valid for the given attribute type.private voidverifyCardinality(AbstractElement report, AbstractIdentifiedType type, int minimumOccurs, int maximumOccurs, int count) Verifies if the given value is compliant with the cardinality constraint.
-
Field Details
-
quality
The data quality report.
-
-
Constructor Details
-
Validator
Validator(org.opengis.metadata.maintenance.ScopeCode scope) Creates a new validator.- Parameters:
scope-FEATUREif the object to validate is a feature, orATTRIBUTEfor an attribute, ornullotherwise.
-
-
Method Details
-
addViolationReport
private AbstractElement addViolationReport(AbstractElement report, AbstractIdentifiedType type, org.opengis.util.InternationalString explanation) Adds a report for a constraint violation. If the givenreportisnull, then this method creates a newDefaultDomainConsistencyinstance with the measure identification set to the property name.Note: settingmeasureIdentificationto the property name may look like a departure from ISO intent, since the former should be an identification of the quality measurement rather than the measure itself. (settingmeasureDescriptiontotype.getDescription()would probably be wrong for that reason). However,measureIdentificationis only an identifier, not a full description of the quality measurement We are not strictly forbidden to use the same identifier for both the quality measurement than the measurement itself. However, strictly speaking, maybe we should use a different scope.- Parameters:
report- where to add the result, ornullif not yet created.type- description of the property for which a constraint violation has been found.explanation- explanation of the constraint violation.- Returns:
- the
report, or a new report ifreportwas null.
-
asList
Wraps singleton value in a collection for processing byvalidate(…)methods. -
validate
Implementation ofAbstractFeature.quality(), also shared byFeaturesstatic method.- Parameters:
type- the type of thefeatureargument, provided explicitly for protecting from user overriding.feature- the feature to validate.
-
validateAny
Verifies if the given value is valid for the given attribute type. This method delegates to one of thevalidate(…)methods depending of the value type. -
validate
Verifies if the given values are valid for the given attribute type. -
validate
Verifies if the given value is valid for the given association role. -
verifyCardinality
private void verifyCardinality(AbstractElement report, AbstractIdentifiedType type, int minimumOccurs, int maximumOccurs, int count) Verifies if the given value is compliant with the cardinality constraint.- Parameters:
report- where to add the result, ornullif not yet created.
-