Interface CanonicalValue<T extends CanonicalValue<T>>
-
- Type Parameters:
T
- Canonical value type
- All Superinterfaces:
Comparable<T>
,Immutable
,MutationBehaviour<Immutable>
,Serializable
- All Known Implementing Classes:
CachingDerivedString
,Decimal64
,DerivedString
,Uint16
,Uint32
,Uint64
,Uint8
@Beta @NonNullByDefault public interface CanonicalValue<T extends CanonicalValue<T>> extends Comparable<T>, Immutable, Serializable
A typed value in its internal Java representation. Implementations of this interface are required to:- be immutable
- be
Serializable
- accurately define total ordering of values
Aside from providing the ability to hold a canonical value, this interface and its implementations support carrying additional information about how the value has been validated -- allowing efficient interchange of already-validated values between users.
validator()
provides the link to aCanonicalValueValidator
which has declared the value conform to it. Users can query the validator to establish whether the value needs to be further validated to conform to their requirement.- Author:
- Robert Varga
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description CanonicalValueSupport<T>
support()
Return theCanonicalValue
associated with this type.String
toCanonicalString()
Return the canonical string representation of this value.default CanonicalValueValidator<T,? extends T>
validator()
Return aCanonicalValueValidator
associated with this value's validated type.-
Methods inherited from interface java.lang.Comparable
compareTo
-
-
-
-
Method Detail
-
toCanonicalString
String toCanonicalString()
Return the canonical string representation of this value.- Returns:
- Canonical string
-
support
CanonicalValueSupport<T> support()
Return theCanonicalValue
associated with this type. It can be used to create new instances of this representation.- Returns:
- A
CanonicalValue
instance.
-
validator
default CanonicalValueValidator<T,? extends T> validator()
Return aCanonicalValueValidator
associated with this value's validated type.- Returns:
- A
CanonicalValueValidator
instance.
-
-