Interface CanonicalValueSupport<T extends CanonicalValue<T>>
-
- Type Parameters:
T
- canonical value type
- All Superinterfaces:
CanonicalValueValidator<T,T>
,Immutable
,MutationBehaviour<Immutable>
- All Known Implementing Classes:
AbstractCanonicalValueSupport
,Decimal64.Support
,Uint16.Support
,Uint32.Support
,Uint64.Support
,Uint8.Support
@Beta @NonNullByDefault public interface CanonicalValueSupport<T extends CanonicalValue<T>> extends CanonicalValueValidator<T,T>
Support for aCanonicalValue
subclasses. An implementation of this interface must be registered in the system and be available from each CanonicalValue object.Note: never implement this interface directly, subclass
AbstractCanonicalValueSupport
instead.This interface allows a
CanonicalValue
to be instantiated from a String. The implementation is expected to perform all checks implied by the corresponding YANG data model.- Author:
- Robert Varga
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Variant<T,CanonicalValueViolation>
fromCanonicalString(String str)
Create a instance for the canonical string representation.Variant<T,CanonicalValueViolation>
fromString(String str)
Create a instance for a string representation.default <X extends CanonicalValue<X>>
CanonicalValueSupport<X>unsafe()
Unsafe cast to a factory type.-
Methods inherited from interface org.opendaylight.yangtools.yang.common.CanonicalValueValidator
getRepresentationClass, getValidatedRepresentationClass, validateRepresentation, validateRepresentation
-
-
-
-
Method Detail
-
fromString
Variant<T,CanonicalValueViolation> fromString(String str)
Create a instance for a string representation. Implementations of this method are required to perform checks equivalent to the YANG data model restrictions attached to the corresponding YANG type. Non-canonical format strings must be accepted and result in objects equal to objects obtained from the corresponding canonical format.- Parameters:
str
- String representation- Returns:
- A
CanonicalValue
instance or CanonicalValueViolation ifstr
does not conform - Throws:
NullPointerException
- ifstr
is null
-
fromCanonicalString
default Variant<T,CanonicalValueViolation> fromCanonicalString(String str)
Create a instance for the canonical string representation. Implementations of this method may perform optimizations based on the assumption the string is canonical, but should still report errors when a mismatch is detected.- Parameters:
str
- String representation- Returns:
- A
CanonicalValue
instance or CanonicalValueViolation ifstr
does not conform - Throws:
NullPointerException
- ifstr
is null
-
unsafe
default <X extends CanonicalValue<X>> CanonicalValueSupport<X> unsafe()
Unsafe cast to a factory type.- Returns:
- This instance cast to specified type
-
-