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 DefaultDataQuality
The data quality report. -
Constructor Summary
ConstructorsConstructorDescriptionValidator
(org.opengis.metadata.maintenance.ScopeCode scope) Creates a new validator. -
Method Summary
Modifier and TypeMethodDescriptionprivate AbstractElement
addViolationReport
(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) void
validate
(DefaultAssociationRole role, Collection<?> values) Verifies if the given value is valid for the given association role.(package private) void
validate
(DefaultAttributeType<?> type, Collection<?> values) Verifies if the given values are valid for the given attribute type.(package private) void
validate
(FeatureType type, AbstractFeature feature) Implementation ofAbstractFeature.quality()
, also shared byFeatures
static method.(package private) void
validateAny
(AbstractIdentifiedType type, Object value) Verifies if the given value is valid for the given attribute type.private void
verifyCardinality
(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
-FEATURE
if the object to validate is a feature, orATTRIBUTE
for an attribute, ornull
otherwise.
-
-
Method Details
-
addViolationReport
private AbstractElement addViolationReport(AbstractElement report, AbstractIdentifiedType type, org.opengis.util.InternationalString explanation) Adds a report for a constraint violation. If the givenreport
isnull
, then this method creates a newDefaultDomainConsistency
instance with the measure identification set to the property name.Note: settingmeasureIdentification
to 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. (settingmeasureDescription
totype.getDescription()
would probably be wrong for that reason). However,measureIdentification
is 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, ornull
if 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 ifreport
was null.
-
asList
Wraps singleton value in a collection for processing byvalidate(…)
methods. -
validate
Implementation ofAbstractFeature.quality()
, also shared byFeatures
static method.- Parameters:
type
- the type of thefeature
argument, 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, ornull
if not yet created.
-