|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object fr.umlv.tatoo.runtime.util.DefaultStringConverter
public class DefaultStringConverter
Default converter implementation. This converter convert a string to a value by using of one of its 'parse' method.
ParseMethod
convert(String,T.class)
.
Nested Class Summary | |
---|---|
static interface |
DefaultStringConverter.ParseMethod
Marker annotation on method, indicates a 'parse' method. |
Constructor Summary | |
---|---|
DefaultStringConverter()
Create a converter. |
Method Summary | ||
---|---|---|
|
convert(String value,
Class<T> clazz)
Convert a string to a value of type T. |
|
protected boolean |
parseBoolean(String text)
Converts a text to a boolean |
|
protected char |
parseChar(String text)
Converts a text to a single char. |
|
protected double |
parseDouble(String text)
Converts a text to a double. |
|
protected
|
parseEnum(String text,
Class<E> clazz)
Convert a text containing the name of an enumeration item to its value. |
|
protected int |
parseInt(String text)
Converts a text to an integer. |
|
protected String |
parseString(String text)
Converts a text to a string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultStringConverter()
Method Detail |
---|
protected char parseChar(String text)
text
- the text to parse.
NumberFormatException
protected String parseString(String text)
text
- the text to parse.
protected int parseInt(String text)
text
- text to parse.
NumberFormatException
- if the text is not an integer.protected double parseDouble(String text)
text
- text to parse.
NumberFormatException
- if the text is not a double.protected boolean parseBoolean(String text)
text
- text to parse.
NumberFormatException
- if the text is not a boolean.protected <E extends Enum<E>> E parseEnum(String text, Class<E> clazz)
E
- type of the enumeration.text
- texte to parse.clazz
- the class of the enumeration.
IllegalArgumentException
- if the text isn't a name
of one of the item of the enumeration.public <T> T convert(String value, Class<T> clazz)
StringConverter
convert
in interface StringConverter
T
- the type of the value.value
- text representation of the value.clazz
- type of the value.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |