01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2002-2006, GeoTools Project Managment Committee (PMC)
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation;
09: * version 2.1 of the License.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: */
16: package org.geotools.util;
17:
18: /**
19: * Converts values of one type into another.
20: *
21: * @author Justin Deoliveira, The Open Planning Project
22: *
23: * @since 2.4
24: */
25: public interface Converter {
26: /**
27: * Converts an object to an object of another type.
28: * <p>
29: * If the converstion supplied is not supported this method can either throw an exception or
30: * return <code>null</code>.
31: * </p>
32: *
33: * @param source The original object, never <code>null</code>
34: * @param target The type of the converted object.
35: *
36: * @return An instance of target, or <code>null</code> if the conversion could not take place.
37: *
38: * @throws Exception If the conversion can not take place.
39: */
40: Object convert(Object source, Class target) throws Exception;
41: }
|