dataparser.java

来自「用applet实现很多应用小程序」· Java 代码 · 共 45 行

JAVA
45
字号
package prefuse.data.parser;


/**
 * Interface for data parsers, which parse data values from text Strings
 * and generated formatted text Strings for data values.
 *
 * @author <a href="http://jheer.org">jeffrey heer</a>
 */
public interface DataParser {
    
    /**
     * Get the data type for the values parsed by this parser.
     * @return the parsed data type for this parser as a Java Class instance
     */
    public Class getType();
    
    
    /**
     * Get a String representation for the given value.
     * @param value the object value to format
     * @return a formatted String representing the input value
     */
    public String format(Object value);
    
    /**
     * Indicates if the given text string can be successfully parsed by
     * this parser.
     * @param text the text string to check for parsability
     * @return true if the string can be successfully parsed into this
     * parser's data type, false otherwise
     */
    public boolean canParse(String text);
    
    /**
     * Parse the given text string to a data value.
     * @param text the text string to parse
     * @return the parsed data value, which will be an instance of the
     * Class returned by the {@link #getType()} method
     * @throws DataParseException if an error occurs during parsing
     */
    public Object parse(String text) throws DataParseException; 
   
} // end of interface DataParser

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?