Class AbstractCanonicalValueSupport<T extends CanonicalValue<T>>
java.lang.Object
org.opendaylight.yangtools.yang.common.AbstractCanonicalValueSupport<T>
- Type Parameters:
T- canonical value type
- All Implemented Interfaces:
Immutable,CanonicalValueSupport<T>,CanonicalValueValidator<T,T>
- Direct Known Subclasses:
Decimal64.Support,Uint16.Support,Uint32.Support,Uint64.Support,Uint8.Support
@Beta
@NonNullByDefault
public abstract class AbstractCanonicalValueSupport<T extends CanonicalValue<T>>
extends Object
implements CanonicalValueSupport<T>
Base implementation of
CanonicalValueSupport. This class should be used as superclass to all implementations
of CanonicalValueSupport, as doing so provides a simpler base and enforces some aspects of the subclass.- Author:
- Robert Varga
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractCanonicalValueSupport(Class<T> representationClass) -
Method Summary
Modifier and TypeMethodDescriptionReturns the instantiated representation class.Return the class which captures the fact it was validated by this validator.final Either<T,CanonicalValueViolation> validateRepresentation(T value) Validate aCanonicalValuerepresentation.final Either<T,CanonicalValueViolation> validateRepresentation(T value, String canonicalString) Validate aCanonicalValuerepresentation.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.opendaylight.yangtools.yang.common.CanonicalValueSupport
fromCanonicalString, fromString, unsafe
-
Constructor Details
-
AbstractCanonicalValueSupport
-
-
Method Details
-
getRepresentationClass
Description copied from interface:CanonicalValueValidatorReturns 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.- Specified by:
getRepresentationClassin interfaceCanonicalValueValidator<T extends CanonicalValue<T>,T extends CanonicalValue<T>> - Returns:
- Representation
CanonicalValueclass.
-
getValidatedRepresentationClass
Description copied from interface:CanonicalValueValidatorReturn the class which captures the fact it was validated by this validator.- Specified by:
getValidatedRepresentationClassin interfaceCanonicalValueValidator<T extends CanonicalValue<T>,T extends CanonicalValue<T>> - Returns:
- Validated capture of the representation class.
-
validateRepresentation
Description copied from interface:CanonicalValueValidatorValidate 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.- Specified by:
validateRepresentationin interfaceCanonicalValueValidator<T extends CanonicalValue<T>,T extends CanonicalValue<T>> - Parameters:
value- Representation value- Returns:
- Validated representation or a
CanonicalValueViolation
-
validateRepresentation
public final Either<T,CanonicalValueViolation> validateRepresentation(T value, String canonicalString) Description copied from interface:CanonicalValueValidatorValidate 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.- Specified by:
validateRepresentationin interfaceCanonicalValueValidator<T extends CanonicalValue<T>,T extends CanonicalValue<T>> - Parameters:
value- Representation valuecanonicalString- Canonical string matching the representation value- Returns:
- Validated representation or a
CanonicalValueViolation
-