prefuse.data.parser
Class AbstractDateParser

java.lang.Object
  extended by prefuse.data.parser.AbstractDateParser
All Implemented Interfaces:
DataParser
Direct Known Subclasses:
DateParser, JavaDateParser

public abstract class AbstractDateParser
extends java.lang.Object
implements DataParser


Field Summary
protected  java.text.DateFormat m_dfmt
           
protected  java.text.ParsePosition m_pos
           
 
Constructor Summary
AbstractDateParser()
          Create a new DateParser.
AbstractDateParser(java.text.DateFormat dateFormat)
          Create a new DateParser.
AbstractDateParser(java.util.Locale locale)
           
 
Method Summary
 boolean canParse(java.lang.String text)
          Indicates if the given text string can be successfully parsed by this parser.
 java.lang.String format(java.lang.Object value)
          Get a String representation for the given value.
abstract  java.lang.Class<?> getType()
          Get the data type for the values parsed by this parser.
 java.lang.Object parse(java.lang.String text)
          Parse the given text string to a data value.
abstract  java.util.Date parseDate(java.lang.String text)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_dfmt

protected java.text.DateFormat m_dfmt

m_pos

protected java.text.ParsePosition m_pos
Constructor Detail

AbstractDateParser

public AbstractDateParser()
Create a new DateParser.


AbstractDateParser

public AbstractDateParser(java.text.DateFormat dateFormat)
Create a new DateParser.

Parameters:
dateFormat - the DateFormat instance to use for parsing

AbstractDateParser

public AbstractDateParser(java.util.Locale locale)
Method Detail

canParse

public final boolean canParse(java.lang.String text)
Description copied from interface: DataParser
Indicates if the given text string can be successfully parsed by this parser.

Specified by:
canParse in interface DataParser
Parameters:
text - the text string to check for parsability
Returns:
true if the string can be successfully parsed into this parser's data type, false otherwise

format

public final java.lang.String format(java.lang.Object value)
Description copied from interface: DataParser
Get a String representation for the given value.

Specified by:
format in interface DataParser
Parameters:
value - the object value to format
Returns:
a formatted String representing the input value

getType

public abstract java.lang.Class<?> getType()
Description copied from interface: DataParser
Get the data type for the values parsed by this parser.

Specified by:
getType in interface DataParser
Returns:
the parsed data type for this parser as a Java Class instance

parse

public final java.lang.Object parse(java.lang.String text)
                             throws DataParseException
Description copied from interface: DataParser
Parse the given text string to a data value.

Specified by:
parse in interface DataParser
Parameters:
text - the text string to parse
Returns:
the parsed data value, which will be an instance of the Class returned by the DataParser.getType() method
Throws:
DataParseException - if an error occurs during parsing

parseDate

public abstract java.util.Date parseDate(java.lang.String text)
                                  throws DataParseException
Throws:
DataParseException


Copyright © 2008 Regents of the University of California