- All Superinterfaces:
Comparable<ToStringProvider<?>>
- All Known Implementing Classes:
AbstractToString,BooleanToString,DoubleToString,EnumToString,FloatToString,IntegerToString,LongToString,NumberToString,StringToString
SPI to serialize and deserialize to and from String, without resorting to serialization.
E.g. a MathContext can be serialized, but can also be written to String and parsed by very naturally.
This can only be used if the type is known beforehand.
-
Method Summary
Modifier and TypeMethodDescriptiondefault intcompareTo(ToStringProvider other) fromString(Class<?> type, @Nullable String value) Given a desired type, and a string value, convert it to the supported type.For given value, check if the type is supported, and then convert it to a String.intweight()
-
Method Details
-
weight
int weight() -
toString
For given value, check if the type is supported, and then convert it to a String. -
fromString
Given a desired type, and a string value, convert it to the supported type. Normally, the given type must be some superclass ofC, but it also might be a primitive type. -
compareTo
- Specified by:
compareToin interfaceComparable<C>
-