|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectolg.csv.bean.parser.AbstractParser<T>
T - object this parser returns.public abstract class AbstractParser<T>
Class used to convert a string into object.
| Constructor Summary | |
|---|---|
AbstractParser()
|
|
| Method Summary | ||
|---|---|---|
static AbstractParser<Character> |
getCharacterParser()
Returns parser specialized in string conversion to Character or char. |
|
static
|
getConstructorParser(Class<T> clazz)
Returns the parser that operates from the constructor of the given class. |
|
static AbstractParser<Date> |
getDateParser(String format,
Class<? extends Date> clazz,
Locale locale)
Returns parser specialized in string conversion to date. |
|
static
|
getEnumParser(Class<E> clazz)
Returns parser specialized in string conversion to Enum. |
|
static AbstractParser |
identifyDefaultParser(Class clazz)
Returns default parser corresponding to the given class. |
|
abstract T |
parse(String str)
Converts a string into a new instance of |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractParser()
| Method Detail |
|---|
public abstract T parse(String str)
throws ParseException
str - the string.
ParseException - if parsing error occurs.
public static AbstractParser<Date> getDateParser(String format,
Class<? extends Date> clazz,
Locale locale)
format - the date format.clazz - The class that the returned parser have to return. this class
must to have java.util.Date as superclass.locale - a Locale to apply. May be null
public static <T> AbstractParser<T> getConstructorParser(Class<T> clazz)
T - the type the parser returnsclazz - The class that the returned parser have to return. This class
must have a constructor with string argument. This constructor
will be used to transform a String into a new Instance of this
class.
public static AbstractParser<Character> getCharacterParser()
public static <E extends Enum<E>> AbstractParser<E> getEnumParser(Class<E> clazz)
this parser identifies the enum constant to return from a string seen as the enum constant name.
E - the type the parser returnsclazz - Enum concret class
public static AbstractParser identifyDefaultParser(Class clazz)
if the given class is not a primitive class, enum, or Character class, try to return a parser based on a constructor of this class accepting a string as argument.
throws an UsageInvalideException In case the parser we are trying to return is based on class constructor and no such constructor exists or is visible.
clazz - the class.
null if none matches the class.ConstructorParser
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||