R - The runtime type of the underlying List value.E - The element type of the underlying List value.public final class ListConfigType<R,E> extends ConfigType<R,List<E>,ListSerializableType<E>>
ConfigType for collections of values. This may be used to represent lists, sets, or vectors.deserializer, serializer| Constructor and Description |
|---|
ListConfigType(ListSerializableType<E> serializedType,
Class<? super R> runtimeType,
Function<List<E>,R> f,
Function<R,List<E>> f0) |
| Modifier and Type | Method and Description |
|---|---|
ListConfigType<R,E> |
constrain(ConstraintAnnotationProcessor<Annotation> processor,
Annotation annotation,
AnnotatedElement annotated)
Applies the constraints defined by the given constraint annotation.
|
<U> ListConfigType<U,E> |
derive(Class<? super U> runtimeType,
Function<R,U> partialDeserializer,
Function<U,R> partialSerializer)
Derive a
ConfigType from this type object. |
ListConfigType<R,E> |
withMaxSize(int max)
Returns a new
ListConfigType with a maximum size constraint. |
ListConfigType<R,E> |
withMinSize(int min)
Returns a new
ListConfigType with a minimum size constraint. |
ListConfigType<R,E> |
withType(ListSerializableType<E> newSpec)
Replace the current serialized type used for specification with the given serialized type.
|
ListConfigType<R,E> |
withUniqueElements()
Returns a new
ListConfigType with a uniqueness constraint. |
getRuntimeType, getSerializedType, toPlatformType, toRuntimeType, toSerializedType, toStringpublic <U> ListConfigType<U,E> 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,List<E>,ListSerializableType<E>>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 ListConfigType<R,E> withType(ListSerializableType<E> newSpec)
ConfigTypewithType in class ConfigType<R,List<E>,ListSerializableType<E>>newSpec - The new type specification.SerializableType.isAssignableFrom(SerializableType)public ListConfigType<R,E> constrain(ConstraintAnnotationProcessor<Annotation> processor, Annotation annotation, AnnotatedElement annotated)
ConfigTypeconstrain in class ConfigType<R,List<E>,ListSerializableType<E>>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 ListConfigType<R,E> withMinSize(int min)
ListConfigType with a minimum size constraint.public ListConfigType<R,E> withMaxSize(int max)
ListConfigType with a maximum size constraint.public ListConfigType<R,E> withUniqueElements()
ListConfigType with a uniqueness constraint.