T - The runtime type of the underlying BigDecimal value.public final class NumberConfigType<T> extends ConfigType<T,BigDecimal,DecimalSerializableType>
ConfigType for numeric ranges.deserializer, serializer| Constructor and Description |
|---|
NumberConfigType(DecimalSerializableType serializedType,
Class<T> runtimeType,
Function<BigDecimal,T> f,
Function<T,BigDecimal> f0) |
| Modifier and Type | Method and Description |
|---|---|
NumberConfigType<T> |
constrain(ConstraintAnnotationProcessor<Annotation> processor,
Annotation annotation,
AnnotatedElement annotated)
Applies the constraints defined by the given constraint annotation.
|
<U> NumberConfigType<U> |
derive(Class<? super U> runtimeType,
Function<T,U> partialDeserializer,
Function<U,T> partialSerializer)
Derive a
ConfigType from this type object. |
NumberConfigType<T> |
withIncrement(T step)
Returns a
NumberConfigType with the given step. |
NumberConfigType<T> |
withMaximum(T max)
Returns a
NumberConfigType with the given maximum value. |
NumberConfigType<T> |
withMinimum(T min)
Returns a
NumberConfigType with the given minimum value. |
NumberConfigType<T> |
withType(DecimalSerializableType newSpec)
Replace the current serialized type used for specification with the given serialized type.
|
NumberConfigType<T> |
withValidRange(T min,
T max,
T step)
Returns a
NumberConfigType with the given range. |
getRuntimeType, getSerializedType, toPlatformType, toRuntimeType, toSerializedType, toStringpublic NumberConfigType(DecimalSerializableType serializedType, Class<T> runtimeType, Function<BigDecimal,T> f, Function<T,BigDecimal> f0)
public <U> NumberConfigType<U> derive(Class<? super U> runtimeType, Function<T,U> partialDeserializer, Function<U,T> partialSerializer)
ConfigTypeConfigType from this type object.
The new ConfigType will have the same serialized type (with the same constraints),
but a different runtime type. Values will be converted between the two
types using composed functions: toSerializedType(x) = this.toSerializedType(partialSerializer(x))
and toRuntimeType(y) = partialDeserializer(this.toRuntimeType(y)).
derive in class ConfigType<T,BigDecimal,DecimalSerializableType>U - the runtime type of the new ConfigTyperuntimeType - a class object representing the runtime type of the new ConfigTypepartialDeserializer - a partial deserialization functionpartialSerializer - a partial serialization functionConfigType with the given runtimeTypepublic NumberConfigType<T> withType(DecimalSerializableType newSpec)
ConfigTypewithType in class ConfigType<T,BigDecimal,DecimalSerializableType>newSpec - The new type specification.SerializableType.isAssignableFrom(SerializableType)public NumberConfigType<T> constrain(ConstraintAnnotationProcessor<Annotation> processor, Annotation annotation, AnnotatedElement annotated)
ConfigTypeconstrain in class ConfigType<T,BigDecimal,DecimalSerializableType>processor - The processor for constraints of this type.annotation - The annotation from which to extract constraints.annotated - The annotated element. For example, a field in a POJO.public NumberConfigType<T> withMinimum(T min)
NumberConfigType with the given minimum value.public NumberConfigType<T> withMaximum(T max)
NumberConfigType with the given maximum value.public NumberConfigType<T> withIncrement(T step)
NumberConfigType with the given step.public NumberConfigType<T> withValidRange(T min, T max, T step)
NumberConfigType with the given range.