/*
 * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.osgi.service.blueprint.container;

/**
 * Provides access to the type conversions (both predefined and user registered)
 * that are defined for the blueprint container.
 */
public interface Converter {

	/**
	 * Check if the converter is able to convert the given value to the specified
	 * type.
	 *
	 * @return <code>true</code> if the conversion is possible, <code>false</code> otherwise.
	 */
	boolean canConvert(Object fromValue, Class toType);

	/**
	 * Convert an object to an instance of the given class, using the built-in and 
	 * user-registered type converters as necessary.
	 * @param fromValue the object to be converted
	 * @param toType the type that the instance is to be converted to
	 * @return an instance of the class 'toType'
	 * @throws Exception if the conversion cannot succeed. This exception is
	 * checked because callers should expect that not all source objects
	 * can be successfully converted.
	 */
	Object convert(Object fromValue, Class toType) throws Exception;
	
}
@@ -840,22 +840,28 @@
 rter %7B%0A%0A
-%09/**%0A%09
+    /**%0A    
  * Check
@@ -930,17 +930,20 @@
 ecified%0A
-%09
+    
  * type.
@@ -947,13 +947,254 @@
 pe.%0A
-%09 *%0A%09
+     *%0A     * @param fromValue The object requiring conversion.%0A     * @param toType    The target type for the conversion.  This will be either%0A     *                  a Class object or a Type object (if running on Java5 or greater).%0A     *%0A    
  * @
@@ -1279,17 +1279,20 @@
 erwise.%0A
-%09
+    
  */%0A%09boo
@@ -1317,37 +1317,38 @@
 ject fromValue, 
-Class
+Object
  toType);%0A%0A%09/**%0A
@@ -1426,17 +1426,16 @@
 t-in and
- 
 %0A%09 * use
@@ -1477,17 +1477,21 @@
 essary.%0A
-%09
+%0A    
  * @para
@@ -1502,17 +1502,17 @@
 omValue 
-t
+T
 he objec
@@ -1517,90 +1517,200 @@
 ect 
-to be converted%0A%09 * @param toType the type that the instance is to be converted to
+requiring conversion.%0A     * @param toType    The target type for the conversion.  This will be either%0A     *                  a Class object or a Type object (if running on Java5 or greater).
 %0A%09 *
@@ -1737,21 +1737,20 @@
  of the 
-class
+type
  'toType
@@ -1969,21 +1969,22 @@
 mValue, 
-Class
+Object
  toType)
@@ -2002,11 +2002,10 @@
 eption;%0A
-%09
 %0A%7D

Change Converter method signatures