Interface CanonicalValueValidator<T extends CanonicalValue<T>,V extends T>
-
- Type Parameters:
T
- canonical value typeV
- validated canonical value type
- All Superinterfaces:
Immutable
,MutationBehaviour<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 aCanonicalValue
representation.Note: this interface should not be directly implemented. Use
AbstractCanonicalValueValidator
instead.- Author:
- Robert Varga
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Class<T>
getRepresentationClass()
Returns the instantiated representation class.Class<V>
getValidatedRepresentationClass()
Return the class which captures the fact it was validated by this validator.default Variant<T,CanonicalValueViolation>
validateRepresentation(T value)
Validate aCanonicalValue
representation.Variant<T,CanonicalValueViolation>
validateRepresentation(T value, String canonicalString)
Validate aCanonicalValue
representation.
-
-
-
Method Detail
-
getRepresentationClass
Class<T> getRepresentationClass()
Returns the instantiated representation class. The representation class is aCanonicalValue
which understands the semantics of modeled data and has some internal representation of it. AllCanonicalValue
s 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 Variant<T,CanonicalValueViolation> validateRepresentation(T value)
Validate aCanonicalValue
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
- ifvalue
is null
-
validateRepresentation
Variant<T,CanonicalValueViolation> validateRepresentation(T value, String canonicalString)
Validate aCanonicalValue
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 valuecanonicalString
- Canonical string matching the representation value- Returns:
- Validated representation or a
CanonicalValueViolation
- Throws:
NullPointerException
- ifvalue
orcanonicalString
is null.
-
-