prefuse.data.parser
Interface DataParser

All Known Implementing Classes:
BooleanParser, ByteParser, ColorIntParser, DateParser, DateTimeParser, DoubleArrayParser, DoubleParser, FloatArrayParser, FloatParser, IntArrayParser, IntParser, LongArrayParser, LongParser, ObjectParser, StringParser, TimeParser

public interface DataParser

Interface for data parsers, which parse data values from text Strings and generated formatted text Strings for data values.

Author:
jeffrey heer

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.
 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.
 

Method Detail

getType

java.lang.Class getType()
Get the data type for the values parsed by this parser.

Returns:
the parsed data type for this parser as a Java Class instance

format

java.lang.String format(java.lang.Object value)
Get a String representation for the given value.

Parameters:
value - the object value to format
Returns:
a formatted String representing the input value

canParse

boolean canParse(java.lang.String text)
Indicates if the given text string can be successfully parsed by this parser.

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

parse

java.lang.Object parse(java.lang.String text)
                       throws DataParseException
Parse the given text string to a data value.

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


Copyright © 2007 Regents of the University of California