org.databene.commons.converter
Class LiteralParser
java.lang.Object
org.databene.commons.converter.AbstractConverter<S,T>
org.databene.commons.converter.ThreadSafeConverter<java.lang.String,java.lang.Object>
org.databene.commons.converter.LiteralParser
- All Implemented Interfaces:
- java.lang.Cloneable, Converter<java.lang.String,java.lang.Object>, ThreadAware
public class LiteralParser
- extends ThreadSafeConverter<java.lang.String,java.lang.Object>
Parses the literal representation a simple type into an appropriate Java object of type
Boolean, Integer, Long, Double, Date or String.
Created: 19.03.2008 20:05:25
- Author:
- Volker Bergmann
|
Method Summary |
java.lang.Object |
convert(java.lang.String sourceValue)
Concerts an object of type S to an object of type T |
static java.lang.Object |
parse(java.lang.String text)
parses a String into a date, number, boolean or String. |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LiteralParser
public LiteralParser()
convert
public java.lang.Object convert(java.lang.String sourceValue)
throws ConversionException
- Description copied from interface:
Converter
- Concerts an object of type S to an object of type T
- Parameters:
sourceValue - the object to convert
- Returns:
- the converted object
- Throws:
ConversionException - if the conversion fails
parse
public static java.lang.Object parse(java.lang.String text)
- parses a String into a date, number, boolean or String.
content := boolean | date | number | unparsed
boolean := 'true' | 'false'
date := digit{4} '-' digit{2} '-' digit{2} ['T' digit{2} ':' digit{2} [':' digit{2} ['.' digit{1,3}]]]
number := [-] digit* ['.' digit*]
- Parameters:
text -
- Returns:
- a date, number, boolean or String that is the object representation of the specified text
Copyright © 2010. All Rights Reserved.