Class Validator

java.lang.Object
org.apache.sis.feature.Validator

final class Validator extends Object
Provides validation methods to be shared by different implementations.
Since:
0.5
Version:
0.7
  • Field Details

  • 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, or ATTRIBUTE for an attribute, or null 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 given report is null, then this method creates a new DefaultDomainConsistency instance with the measure identification set to the property name.
      Note: setting measureIdentification 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. (setting measureDescription to type.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, or null 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 if report was null.
    • asList

      private static Collection<?> asList(Object value, int maximumOccurrences)
      Wraps singleton value in a collection for processing by validate(…) methods.
    • validate

      void validate(FeatureType type, AbstractFeature feature)
      Implementation of AbstractFeature.quality(), also shared by Features static method.
      Parameters:
      type - the type of the feature argument, provided explicitly for protecting from user overriding.
      feature - the feature to validate.
    • validateAny

      void validateAny(AbstractIdentifiedType type, Object value)
      Verifies if the given value is valid for the given attribute type. This method delegates to one of the validate(…) methods depending of the value type.
    • validate

      void validate(DefaultAttributeType<?> type, Collection<?> values)
      Verifies if the given values are valid for the given attribute type.
    • validate

      void validate(DefaultAssociationRole role, Collection<?> values)
      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, or null if not yet created.