ObjectConverter changes for revisions 23076:23648

The original interface is work from the Open Planning Project. See the discussion at revision 22626 for more information.

Command line:

svn diff --extensions "--unified --ignore-space-change --ignore-all-space --ignore-eol-style" -r23076:23648 https://svn.osgeo.org/geotools/trunk/modules/library/api/src/main/java/org/geotools/util/Converter.java
Revision 23076Revision 23648
 *
 * @author Justin Deoliveira, The Open Planning Project
 *
 */
public interface Converter {
    /**
     * Determines if this converter can convert instances of one type into another.
     *
     * @param source The type being converted from.
     * @param terget The type being converted to.
     *
     * @return <code>true</code> if the conversion can take place with the givem arguments,
     * otherwise <code>false</code>.
     */
    boolean canConvert(Class source, Class target);

    /**
     * Converts an object to an object of another type.
     * <p>
     * This method should not be called unless <code>canConvert( object.getClass(), target )<code>
     * returns <code>true</code>.
     * </p>
     *
     * @param source The original object, never <code>null</code>
     * @param target The type of the converted object.
     *
     * @return An instance of target, or <code>null</code> if the conversion could not take place.
     */
    Object convert(Object source, Class target) throws Exception;
}
 *
 * @author Justin Deoliveira, The Open Planning Project
 *
 * @since 2.4
 */
public interface Converter {
    /**
     * Converts an object to an object of another type.
     * <p>
     * If the converstion supplied is not supported this method can either throw an exception or
     * return <code>null</code>.
     * </p>
     *
     * @param source The original object, never <code>null</code>
     * @param target The type of the converted object.
     *
     * @return An instance of target, or <code>null</code> if the conversion could not take place.
     *
     * @throws Exception If the conversion can not take place.
     */
    Object convert(Object source, Class target) throws Exception;
}