Interface CanonicalValueValidator<T extends CanonicalValue<T>,V extends T>
- Type Parameters:
T- canonical value typeV- 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 Summary
Modifier and TypeMethodDescriptionReturns the instantiated representation class.Return the class which captures the fact it was validated by this validator.default Either<T,CanonicalValueViolation> validateRepresentation(T value) Validate aCanonicalValuerepresentation.validateRepresentation(T value, String canonicalString) Validate aCanonicalValuerepresentation.
-
Method Details
-
getRepresentationClass
Returns the instantiated representation class. The representation class is aCanonicalValuewhich understands the semantics of modeled data and has some internal representation of it. AllCanonicalValues 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
CanonicalValueclass.
-
getValidatedRepresentationClass
Return the class which captures the fact it was validated by this validator.- Returns:
- Validated capture of the representation class.
-
validateRepresentation
Validate aCanonicalValuerepresentation. 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- ifvalueis null
-
validateRepresentation
Validate aCanonicalValuerepresentation. 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 valuecanonicalString- Canonical string matching the representation value- Returns:
- Validated representation or a
CanonicalValueViolation - Throws:
NullPointerException- ifvalueorcanonicalStringis null.
-