Interface CanonicalValue<T extends CanonicalValue<T>>
- Type Parameters:
T- Canonical value type
- All Superinterfaces:
Comparable<T>,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 a CanonicalValueValidator 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
Modifier and TypeMethodDescriptionsupport()Return theCanonicalValueassociated with this type.Return the canonical string representation of this value.default CanonicalValueValidator<T,? extends T> Return aCanonicalValueValidatorassociated with this value's validated type.Methods inherited from interface java.lang.Comparable
compareTo
-
Method Details
-
toCanonicalString
String toCanonicalString()Return the canonical string representation of this value.- Returns:
- Canonical string
-
support
CanonicalValueSupport<T> support()Return theCanonicalValueassociated with this type. It can be used to create new instances of this representation.- Returns:
- A
CanonicalValueinstance.
-
validator
Return aCanonicalValueValidatorassociated with this value's validated type.- Returns:
- A
CanonicalValueValidatorinstance.
-