KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portal > common > value > Converter


1 /*****************************************
2  * *
3  * JBoss Portal: The OpenSource Portal *
4  * *
5  * Distributable under LGPL license. *
6  * See terms of license at gnu.org. *
7  * *
8  *****************************************/

9 package org.jboss.portal.common.value;
10
11
12 /**
13  * @author <a HREF="mailto:julien@jboss.org">Julien Viet</a>
14  * @version $Revision: 1.1.1.1 $
15  */

16 public interface Converter
17 {
18    /**
19     * Return true if the converter accepts the class for conversion.
20     *
21     * @throws IllegalArgumentException if the class object is null
22     */

23    boolean accept(Class JavaDoc clazz);
24
25    /**
26     * String to object conversion.
27     *
28     * @throws NullConversionException if the value nullity prevent the conversion
29     * @throws FormatConversionException if the value cannot be converted
30     */

31    Object JavaDoc toObject(String JavaDoc value) throws NullConversionException, FormatConversionException;
32
33    /**
34     * Convert the object to the stored value.
35     *
36     * @throws NullConversionException if the value nullity prevent the conversion
37     * @throws FormatConversionException if the value cannot be converted
38     */

39    String JavaDoc toString(Object JavaDoc value) throws NullConversionException, FormatConversionException;
40 }
41
Popular Tags