prefuse.data.parser
Class TimeParser
java.lang.Object
prefuse.data.parser.AbstractDateParser
prefuse.data.parser.DateParser
prefuse.data.parser.TimeParser
- All Implemented Interfaces:
- DataParser
public class TimeParser
- extends DateParser
DataParser instance that parses Date values as java.util.Time instances,
representing a particular time (but no specific date).
This class uses a backing DateFormat
instance to
perform parsing. The DateFormat instance to use can be passed in to the
constructor, or by default the DateFormat returned by
DateFormat.getTimeInstance(int)
with an
argument of DateFormat.SHORT
is used.
- Author:
- jeffrey heer
Constructor Summary |
TimeParser()
Create a new TimeParser. |
TimeParser(java.text.DateFormat dateFormat)
Create a new TimeParser. |
TimeParser(java.util.Locale locale)
|
Method Summary |
java.lang.Class<?> |
getType()
Returns java.sql.Time.class. |
java.sql.Time |
parseTime(java.lang.String text)
Parse a Time value from a text string. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TimeParser
public TimeParser()
- Create a new TimeParser.
TimeParser
public TimeParser(java.text.DateFormat dateFormat)
- Create a new TimeParser.
- Parameters:
dateFormat
- the DateFormat instance to use for parsing
TimeParser
public TimeParser(java.util.Locale locale)
getType
public java.lang.Class<?> getType()
- Returns java.sql.Time.class.
- Specified by:
getType
in interface DataParser
- Overrides:
getType
in class DateParser
- Returns:
- the parsed data type for this parser as a Java Class instance
- See Also:
DataParser.getType()
parseTime
public java.sql.Time parseTime(java.lang.String text)
throws DataParseException
- Parse a Time value from a text string.
- Parameters:
text
- the text string to parse
- Returns:
- the parsed Time value
- Throws:
DataParseException
- if an error occurs during parsing
Copyright © 2008 Regents of the University of California