Title: [waffle-scm] [405] trunk/waffle-core/src/main/java/org/codehaus/waffle/bind: Refactored ValueConverter to not declare runtime BindException - but document it in javadoc.

Diff

Modified: trunk/examples/paranamer-example/src/main/java/org/codehaus/waffle/example/paranamer/DateValueConverter.java (404 => 405)

--- trunk/examples/paranamer-example/src/main/java/org/codehaus/waffle/example/paranamer/DateValueConverter.java	2007-11-20 11:57:12 UTC (rev 404)
+++ trunk/examples/paranamer-example/src/main/java/org/codehaus/waffle/example/paranamer/DateValueConverter.java	2007-11-20 12:11:50 UTC (rev 405)
@@ -28,7 +28,7 @@
         return Date.class.isAssignableFrom(type);
     }
 
-    public Object convertValue(String propertyName, String value, Class<?> toType) throws BindException {
+    public Object convertValue(String propertyName, String value, Class<?> toType) {
         if (value == null || value.equals("")) {
             return null;
         }

Modified: trunk/examples/simple-example/src/main/java/org/codehaus/waffle/example/simple/DateValueConverter.java (404 => 405)

--- trunk/examples/simple-example/src/main/java/org/codehaus/waffle/example/simple/DateValueConverter.java	2007-11-20 11:57:12 UTC (rev 404)
+++ trunk/examples/simple-example/src/main/java/org/codehaus/waffle/example/simple/DateValueConverter.java	2007-11-20 12:11:50 UTC (rev 405)
@@ -28,7 +28,7 @@
         return Date.class.isAssignableFrom(type);
     }
 
-    public Object convertValue(String propertyName, String value, Class<?> toType) throws BindException {
+    public Object convertValue(String propertyName, String value, Class<?> toType) {
         if (value == null || value.equals("")) {
             return null;
         }

Modified: trunk/waffle-core/src/main/java/org/codehaus/waffle/bind/OgnlValueConverter.java (404 => 405)

--- trunk/waffle-core/src/main/java/org/codehaus/waffle/bind/OgnlValueConverter.java	2007-11-20 11:57:12 UTC (rev 404)
+++ trunk/waffle-core/src/main/java/org/codehaus/waffle/bind/OgnlValueConverter.java	2007-11-20 12:11:50 UTC (rev 405)
@@ -34,7 +34,7 @@
         return true;
     }
 
-    public Object convertValue(String propertyName, String value, Class<?> toType) throws BindException {
+    public Object convertValue(String propertyName, String value, Class<?> toType) {
         return converter.convertValue(null, null, null, propertyName, value, toType);
     }
 

Modified: trunk/waffle-core/src/main/java/org/codehaus/waffle/bind/ValueConverter.java (404 => 405)

--- trunk/waffle-core/src/main/java/org/codehaus/waffle/bind/ValueConverter.java	2007-11-20 11:57:12 UTC (rev 404)
+++ trunk/waffle-core/src/main/java/org/codehaus/waffle/bind/ValueConverter.java	2007-11-20 12:11:50 UTC (rev 405)
@@ -14,11 +14,27 @@
  * Implementation of this interface will be responsible for converting values of specific type(s).
  *
  * @author Michael Ward
+ * @author Mauro Talevi
  */
 public interface ValueConverter {
 
+    /**
+     * Determines if converter is compatible with the given type
+     * 
+     * @param type the type of the field a value is to be bound to
+     * @return A boolean <code>true</code> is type is compatible
+     */
     boolean accept(Class<?> type);
 
-    Object convertValue(String propertyName, String value, Class<?> toType) throws BindException;
+    /**
+     * Converts a String value to an Object of a given type
+     * 
+     * @param propertyName the associated property name, which can be <code>null</code>
+     * @param value the String value
+     * @param toType  the Object type
+     * @return The converted Object
+     * @throws BindException if conversion fails
+     */
+    Object convertValue(String propertyName, String value, Class<?> toType);
 
 }


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to