prefuse.data.parser
Class TimeParser

java.lang.Object
  extended by prefuse.data.parser.AbstractDateParser
      extended by prefuse.data.parser.DateParser
          extended by 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

Field Summary
 
Fields inherited from class prefuse.data.parser.DateParser
m_dfmt, m_pos
 
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 prefuse.data.parser.DateParser
parseDate
 
Methods inherited from class prefuse.data.parser.AbstractDateParser
canParse, format, parse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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)
Method Detail

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