T - The runtime type of the underlying String value.public final class StringConfigType<T> extends ConfigType<T,String,StringSerializableType>
ConfigType for regex-defined string values.deserializer, serializer| Constructor and Description |
|---|
StringConfigType(StringSerializableType serializedType,
Class<T> runtimeType,
Function<String,T> f,
Function<T,String> f0) |
| Modifier and Type | Method and Description |
|---|---|
StringConfigType<T> |
constrain(ConstraintAnnotationProcessor<Annotation> processor,
Annotation annotation,
AnnotatedElement annotated)
Applies the constraints defined by the given constraint annotation.
|
<U> StringConfigType<U> |
derive(Class<? super U> runtimeType,
Function<T,U> partialDeserializer,
Function<U,T> partialSerializer)
Derive a
ConfigType from this type object. |
StringConfigType<T> |
withMaxLength(int max)
Returns a new
StringConfigType with a maximum length constraint. |
StringConfigType<T> |
withMinLength(int min)
Returns a new
StringConfigType with a minimum length constraint. |
StringConfigType<T> |
withPattern(Pattern pattern)
Returns a new
StringConfigType with a regex constraint defined by the given pattern. |
StringConfigType<T> |
withPattern(String regex)
Returns a new
StringConfigType with a regex constraint defined by the given pattern string. |
StringConfigType<T> |
withType(StringSerializableType newSpec)
Replace the current serialized type used for specification with the given serialized type.
|
getRuntimeType, getSerializedType, toPlatformType, toRuntimeType, toSerializedType, toStringpublic <U> StringConfigType<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,String,StringSerializableType>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 StringConfigType<T> withType(StringSerializableType newSpec)
ConfigTypewithType in class ConfigType<T,String,StringSerializableType>newSpec - The new type specification.SerializableType.isAssignableFrom(SerializableType)public StringConfigType<T> constrain(ConstraintAnnotationProcessor<Annotation> processor, Annotation annotation, AnnotatedElement annotated)
ConfigTypeconstrain in class ConfigType<T,String,StringSerializableType>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 StringConfigType<T> withMinLength(int min)
StringConfigType with a minimum length constraint.public StringConfigType<T> withMaxLength(int max)
StringConfigType with a maximum length constraint.public StringConfigType<T> withPattern(String regex)
StringConfigType with a regex constraint defined by the given pattern string.PatternSyntaxException - If regex is not a valid Pattern.withPattern(Pattern)public StringConfigType<T> withPattern(Pattern pattern)
StringConfigType with a regex constraint defined by the given pattern.