public final class StringSerializableType extends PlainSerializableType<String>
SerializableType for regex-defined String values.| Modifier and Type | Field and Description |
|---|---|
static StringSerializableType |
DEFAULT_STRING |
| Constructor and Description |
|---|
StringSerializableType(int minLength,
int maxLength,
Pattern pattern) |
| Modifier and Type | Method and Description |
|---|---|
<S> String |
deserializeValue(S elem,
ValueSerializer<S,?> serializer)
Deserializes a config primitive from a serialized form.
|
boolean |
equals(Object o)
Two serialized types are equal if and only if they are of the same kind
and both have the same constraints.
|
int |
getMaxLength()
Specifies a maximum string length.
|
int |
getMinLength()
Specifies a minimum string length.
|
Pattern |
getPattern()
Specifies a pattern that must match.
|
int |
hashCode() |
<S> void |
serialize(TypeSerializer<S> serializer,
S target)
Serializes this type to a persistent format using the given
TypeSerializer. |
<S> S |
serializeValue(String value,
ValueSerializer<S,?> serializer)
Serializes a config primitive to a serialized form.
|
String |
toString() |
cast, getErasedPlatformType, getGenericPlatformTypeaccepts, isAssignableFrom, testpublic static final StringSerializableType DEFAULT_STRING
public int getMinLength()
Values must be of equal or longer length than the returned value to satisfy the constraint. For example: if the min length is 3.
"AB" would not satisfy the constraint"ABC" and "ABCD" would satisfy the constraintpublic int getMaxLength()
Values must be of equal or shorter length than the returned value to satisfy the constraint. For example: if the max length is 3.
"AB" and "ABC" would satisfy the constraint"ABCD" would not satisfy the constraint@Nullable public Pattern getPattern()
Values must match the constraint's value, which is a regular expression (regex).
public <S> void serialize(TypeSerializer<S> serializer, S target)
SerializableTypeTypeSerializer.serialize in class SerializableType<String>S - The type to serialize to.serializer - The type serializer to use.target - The place to which this type is serialized.TypeSerializerpublic <S> S serializeValue(String value, ValueSerializer<S,?> serializer)
SerializableTypeSerializableType.cast(Object) and additionally
satisfy this type's particular constraints.serializeValue in class SerializableType<String>S - The type of the serialized form.value - The value to serialize.serializer - A ValueSerializer defining the serialized form.public <S> String deserializeValue(S elem, ValueSerializer<S,?> serializer) throws ValueDeserializationException
SerializableTypedeserializeValue in class SerializableType<String>S - The type of the serialized form.elem - The serialized form of the value.serializer - A ValueSerializer defining the serialized form.ValueDeserializationException - If a value cannot be deserialized.public boolean equals(Object o)
SerializableTypeequals in class SerializableType<String>public int hashCode()
hashCode in class SerializableType<String>public String toString()
toString in class SerializableType<String>