StringConverter looking up types.
This class is immutable and thread-safe.
This parses the string format of Type.
This is achieved thanks to some code copied from Guava. (A Guava dependency is painful when building a Java 6 library for Java 9)
This parser is incomplete, but handles common cases. It does not handle union types or multi-dimensional arrays.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final TypeStringConverterFactory | INSTANCE
Singleton instance. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public StringConverter | Returns: the converter, null if not foundthe type to lookup, not null cls)Implements org. |
| public String |
| INSTANCE | back to summary |
|---|---|
| pack-priv static final TypeStringConverterFactory INSTANCE Singleton instance. | |
| TypeStringConverterFactory | back to summary |
|---|---|
| private TypeStringConverterFactory() Restricted constructor. | |
| findConverter | back to summary |
|---|---|
| public StringConverter Implements org. Finds a converter by type.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| Modifier and Type | Field and Description |
|---|---|
| private final Class |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public Type | convertFromString(Class<? extends Type>
the class to convert to, not null cls, String the string to convert, not null str)Implements org. String.
|
| public String | convertToString(Type
the object to convert, not null type)Implements org. String.
|
| public Class | getEffectiveType()
Implements org. |
| effectiveType | back to summary |
|---|---|
| private final Class<?> effectiveType | |
| TypeStringConverter | back to summary |
|---|---|
| pack-priv TypeStringConverter(Class<?> effectiveType) | |
| convertFromString | back to summary |
|---|---|
| public Type convertFromString(Class<? extends Type> cls, String str) Implements org. Doc from org. Converts the specified object from a | |
| convertToString | back to summary |
|---|---|
| public String convertToString(Type type) Implements org. Doc from org. Converts the specified object to a | |
| getEffectiveType | back to summary |
|---|---|
| public Class Implements org. Doc from org. Gets the effective type that the converter works on.
For example, if a class declares the | |