Interface CanonicalValueValidator<T extends CanonicalValue<T>,V extends T>

Type Parameters:
T - canonical value type
V - validated canonical value type
All Superinterfaces:
Immutable
All Known Subinterfaces:
CanonicalValueSupport<T>
All Known Implementing Classes:
AbstractCanonicalValueSupport, AbstractCanonicalValueValidator, Decimal64.Support, Uint16.Support, Uint32.Support, Uint64.Support, Uint8.Support

@Beta @NonNullByDefault public interface CanonicalValueValidator<T extends CanonicalValue<T>,V extends T> extends Immutable
CanonicalValue validator interface. Implementations of this interface can perform further validation of representation state such that it conforms to a YANG type derived from a type with a CanonicalValue representation.

Note: this interface should not be directly implemented. Use AbstractCanonicalValueValidator instead.

Author:
Robert Varga
  • Method Details

    • getRepresentationClass

      Class<T> getRepresentationClass()
      Returns the instantiated representation class. The representation class is a CanonicalValue which understands the semantics of modeled data and has some internal representation of it. All CanonicalValues which share the same representation class are considered equal if their internal state would result in the same canonical string representation as defined by the YANG data model.
      Returns:
      Representation CanonicalValue class.
    • getValidatedRepresentationClass

      Class<V> getValidatedRepresentationClass()
      Return the class which captures the fact it was validated by this validator.
      Returns:
      Validated capture of the representation class.
    • validateRepresentation

      default Either<T,CanonicalValueViolation> validateRepresentation(T value)
      Validate a CanonicalValue representation. Implementations should override this method if they can provide a validation algorithm which does not rely on canonical strings but works on representation state only.
      Parameters:
      value - Representation value
      Returns:
      Validated representation or a CanonicalValueViolation
      Throws:
      NullPointerException - if value is null
    • validateRepresentation

      Either<T,CanonicalValueViolation> validateRepresentation(T value, String canonicalString)
      Validate a CanonicalValue representation. Implementations can chose whether they operate on representation state or canonical string -- both are considered equivalent. Users should call this method if they have a representation readily available.
      Parameters:
      value - Representation value
      canonicalString - Canonical string matching the representation value
      Returns:
      Validated representation or a CanonicalValueViolation
      Throws:
      NullPointerException - if value or canonicalString is null.