R - The runtime type of the underlying Map value.V - The value type stored in the underlying Map value.public final class MapConfigType<R,V> extends ConfigType<R,Map<String,V>,MapSerializableType<V>>
ConfigType for mappings between a key type and a value type.deserializer, serializer| Constructor and Description |
|---|
MapConfigType(MapSerializableType<V> serializedType,
Class<? super R> runtimeType,
Function<Map<String,V>,R> f,
Function<R,Map<String,V>> f0) |
| Modifier and Type | Method and Description |
|---|---|
MapConfigType<R,V> |
constrain(ConstraintAnnotationProcessor<Annotation> processor,
Annotation annotation,
AnnotatedElement annotated)
Applies the constraints defined by the given constraint annotation.
|
<U> MapConfigType<U,V> |
derive(Class<? super U> runtimeType,
Function<R,U> partialDeserializer,
Function<U,R> partialSerializer)
Derive a
ConfigType from this type object. |
MapConfigType<R,V> |
withMaxSize(int max)
Creates a new
MapConfigType with a maximum size constraint. |
MapConfigType<R,V> |
withMinSize(int min)
Creates a new
MapConfigType with a minimum size constraint. |
MapConfigType<R,V> |
withType(MapSerializableType<V> newSpec)
Replace the current serialized type used for specification with the given serialized type.
|
getRuntimeType, getSerializedType, toPlatformType, toRuntimeType, toSerializedType, toStringpublic <U> MapConfigType<U,V> derive(Class<? super U> runtimeType, Function<R,U> partialDeserializer, Function<U,R> 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<R,Map<String,V>,MapSerializableType<V>>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 MapConfigType<R,V> withType(MapSerializableType<V> newSpec)
ConfigTypewithType in class ConfigType<R,Map<String,V>,MapSerializableType<V>>newSpec - The new type specification.SerializableType.isAssignableFrom(SerializableType)public MapConfigType<R,V> withMinSize(int min)
MapConfigType with a minimum size constraint.public MapConfigType<R,V> withMaxSize(int max)
MapConfigType with a maximum size constraint.public MapConfigType<R,V> constrain(ConstraintAnnotationProcessor<Annotation> processor, Annotation annotation, AnnotatedElement annotated)
ConfigTypeconstrain in class ConfigType<R,Map<String,V>,MapSerializableType<V>>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.