You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Adrian Crum <ad...@yahoo.com> on 2009/11/12 02:27:39 UTC

Re: svn commit: r835164 - in /ofbiz/trunk/framework: base/src/org/ofbiz/base/conversion/ entity/src/org/ofbiz/entity/util/

Thanks Adam - those are good improvements!

-Adrian

--- On Wed, 11/11/09, doogie@apache.org <do...@apache.org> wrote:

> From: doogie@apache.org <do...@apache.org>
> Subject: svn commit: r835164 - in /ofbiz/trunk/framework: base/src/org/ofbiz/base/conversion/ entity/src/org/ofbiz/entity/util/
> To: commits@ofbiz.apache.org
> Date: Wednesday, November 11, 2009, 3:47 PM
> Author: doogie
> Date: Wed Nov 11 23:47:03 2009
> New Revision: 835164
> 
> URL: http://svn.apache.org/viewvc?rev=835164&view=rev
> Log:
> Move getSourceClass and getTargetClass into the base class;
> removes a
> bunch of code.  This also nescessitated the creation
> of a helper class
> for collection containment.
> 
> Added:
>    
> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/AbstractCollectionConverter.java
>       - copied, changed from r835161,
> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/AbstractConverter.java
> Modified:
>    
> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/AbstractConverter.java
>    
> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/AbstractLocalizedConverter.java
>    
> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/BooleanConverters.java
>    
> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/CollectionConverters.java
>    
> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/DateTimeConverters.java
>    
> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/MiscConverters.java
>    
> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/NumberConverters.java
>    
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/Converters.java
> 
> Copied:
> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/AbstractCollectionConverter.java
> (from r835161,
> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/AbstractConverter.java)
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/AbstractCollectionConverter.java?p2=ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/AbstractCollectionConverter.java&p1=ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/AbstractConverter.java&r1=835161&r2=835164&rev=835164&view=diff
> ==============================================================================
> ---
> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/AbstractConverter.java
> (original)
> +++
> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/AbstractCollectionConverter.java
> Wed Nov 11 23:47:03 2009
> @@ -18,14 +18,20 @@
>  
> *******************************************************************************/
>  package org.ofbiz.base.conversion;
>  
> +import java.util.Collection;
> +
>  import org.ofbiz.base.util.ObjectType;
>  
> -/** Abstract Converter class. This class handles converter
> registration
> +/** Abstract Set Converter class. This class handles
> converter registration
>   * and it implements the
> <code>canConvert</code> method.
>   */
> -public abstract class AbstractConverter<S, T>
> implements Converter<S, T> {
> +public abstract class AbstractCollectionConverter<S, T
> extends Collection<S>> implements Converter<S,
> T> {
> +    private final Class<S> sourceClass;
> +    private final Class<? super T>
> targetClass;
>  
> -    public AbstractConverter() {
> +    protected
> AbstractCollectionConverter(Class<S> sourceClass,
> Class<? super T> targetClass) {
> +        this.sourceClass =
> sourceClass;
> +        this.targetClass =
> targetClass;
>      
>    Converters.registerConverter(this);
>      }
>  
> @@ -33,4 +39,11 @@
>          return
> ObjectType.instanceOf(sourceClass, this.getSourceClass())
> && ObjectType.instanceOf(targetClass,
> this.getTargetClass());
>      }
>  
> +    public final Class<S> getSourceClass()
> {
> +        return sourceClass;
> +    }
> +
> +    public final Class<? super T>
> getTargetClass() {
> +        return targetClass;
> +    }
>  }
> 
> Modified:
> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/AbstractConverter.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/AbstractConverter.java?rev=835164&r1=835163&r2=835164&view=diff
> ==============================================================================
> ---
> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/AbstractConverter.java
> (original)
> +++
> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/AbstractConverter.java
> Wed Nov 11 23:47:03 2009
> @@ -24,8 +24,12 @@
>   * and it implements the
> <code>canConvert</code> method.
>   */
>  public abstract class AbstractConverter<S, T>
> implements Converter<S, T> {
> +    private final Class<S> sourceClass;
> +    private final Class<T> targetClass;
>  
> -    public AbstractConverter() {
> +    protected AbstractConverter(Class<S>
> sourceClass, Class<T> targetClass) {
> +        this.sourceClass =
> sourceClass;
> +        this.targetClass =
> targetClass;
>      
>    Converters.registerConverter(this);
>      }
>  
> @@ -33,4 +37,11 @@
>          return
> ObjectType.instanceOf(sourceClass, this.getSourceClass())
> && ObjectType.instanceOf(targetClass,
> this.getTargetClass());
>      }
>  
> +    public final Class<S> getSourceClass()
> {
> +        return sourceClass;
> +    }
> +
> +    public final Class<T> getTargetClass()
> {
> +        return targetClass;
> +    }
>  }
> 
> Modified:
> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/AbstractLocalizedConverter.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/AbstractLocalizedConverter.java?rev=835164&r1=835163&r2=835164&view=diff
> ==============================================================================
> ---
> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/AbstractLocalizedConverter.java
> (original)
> +++
> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/AbstractLocalizedConverter.java
> Wed Nov 11 23:47:03 2009
> @@ -24,8 +24,12 @@
>   * and it implements the
> <code>canConvert</code> method.
>   */
>  public abstract class AbstractLocalizedConverter<S,
> T> implements LocalizedConverter<S, T> {
> +    private final Class<S> sourceClass;
> +    private final Class<T> targetClass;
>  
> -    public AbstractLocalizedConverter() {
> +    protected
> AbstractLocalizedConverter(Class<S> sourceClass,
> Class<T> targetClass) {
> +        this.sourceClass =
> sourceClass;
> +        this.targetClass =
> targetClass;
>      
>    Converters.registerConverter(this);
>      }
>  
> @@ -33,4 +37,11 @@
>          return
> ObjectType.instanceOf(sourceClass, this.getSourceClass())
> && ObjectType.instanceOf(targetClass,
> this.getTargetClass());
>      }
>  
> +    public final Class<S> getSourceClass()
> {
> +        return sourceClass;
> +    }
> +
> +    public final Class<T> getTargetClass()
> {
> +        return targetClass;
> +    }
>  }
> 
> Modified:
> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/BooleanConverters.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/BooleanConverters.java?rev=835164&r1=835163&r2=835164&view=diff
> ==============================================================================
> ---
> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/BooleanConverters.java
> (original)
> +++
> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/BooleanConverters.java
> Wed Nov 11 23:47:03 2009
> @@ -23,64 +23,47 @@
>  
>      public static class
> BooleanToInteger extends AbstractConverter<Boolean,
> Integer> {
>  
> -        public Integer convert(Boolean
> obj) throws ConversionException {
> -         
>    return obj.booleanValue() ? 1 : 0;
> -        }
> -
> -        public Class<Boolean>
> getSourceClass() {
> -            return
> Boolean.class;
> +        public BooleanToInteger() {
> +           
> super(Boolean.class, Integer.class);
>          }
>  
> -        public Class<Integer>
> getTargetClass() {
> -            return
> Integer.class;
> +        public Integer convert(Boolean
> obj) throws ConversionException {
> +         
>    return obj.booleanValue() ? 1 : 0;
>          }
>  
>      }
>  
>      public static class
> BooleanToString extends AbstractConverter<Boolean,
> String> {
>  
> -        public String convert(Boolean
> obj) throws ConversionException {
> -            return
> obj.booleanValue() ? "true" : "false";
> -        }
> -
> -        public Class<Boolean>
> getSourceClass() {
> -            return
> Boolean.class;
> +        public BooleanToString() {
> +           
> super(Boolean.class, String.class);
>          }
>  
> -        public Class<String>
> getTargetClass() {
> -            return
> String.class;
> +        public String convert(Boolean
> obj) throws ConversionException {
> +            return
> obj.booleanValue() ? "true" : "false";
>          }
>  
>      }
>  
>      public static class
> IntegerToBoolean extends AbstractConverter<Integer,
> Boolean> {
>  
> -        public Boolean convert(Integer
> obj) throws ConversionException {
> -         
>    return obj.intValue() == 0 ? false :
> true;
> -        }
> -
> -        public Class<Integer>
> getSourceClass() {
> -            return
> Integer.class;
> +        public IntegerToBoolean() {
> +           
> super(Integer.class, Boolean.class);
>          }
>  
> -        public Class<Boolean>
> getTargetClass() {
> -            return
> Boolean.class;
> +        public Boolean convert(Integer
> obj) throws ConversionException {
> +         
>    return obj.intValue() == 0 ? false :
> true;
>          }
> -
>      }
>  
>      public static class
> StringToBoolean extends AbstractConverter<String,
> Boolean> {
>  
> -        public Boolean convert(String
> obj) throws ConversionException {
> -            return
> "TRUE".equals(obj.toUpperCase());
> -        }
> -
> -        public Class<String>
> getSourceClass() {
> -            return
> String.class;
> +        public StringToBoolean() {
> +           
> super(String.class, Boolean.class);
>          }
>  
> -        public Class<Boolean>
> getTargetClass() {
> -            return
> Boolean.class;
> +        public Boolean convert(String
> obj) throws ConversionException {
> +            return
> "TRUE".equals(obj.toUpperCase());
>          }
>          
>      }
> 
> Modified:
> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/CollectionConverters.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/CollectionConverters.java?rev=835164&r1=835163&r2=835164&view=diff
> ==============================================================================
> ---
> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/CollectionConverters.java
> (original)
> +++
> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/CollectionConverters.java
> Wed Nov 11 23:47:03 2009
> @@ -25,6 +25,7 @@
>  
>  import org.ofbiz.base.util.ObjectType;
>  import org.ofbiz.base.util.StringUtil;
> +import org.ofbiz.base.util.UtilGenerics;
>  
>  import javolution.util.FastList;
>  import javolution.util.FastSet;
> @@ -32,7 +33,11 @@
>  /** Collection Converter classes. */
>  public class CollectionConverters implements
> ConverterLoader {
>  
> -    public static class ArrayToList extends
> AbstractConverter<Object[], List<?>> {
> +    public static class ArrayToList extends
> AbstractConverter<Object[], List> {
> +
> +        public ArrayToList() {
> +           
> super(Object[].class, List.class);
> +        }
>  
>          @Override
>          public boolean
> canConvert(Class<?> sourceClass, Class<?>
> targetClass) {
> @@ -43,94 +48,67 @@
>              return
> Arrays.asList(obj);
>          }
>  
> -        public Class<Object[]>
> getSourceClass() {
> -            return
> Object[].class;
> -        }
> -
> -       
> @SuppressWarnings("unchecked")
> -        public Class<List>
> getTargetClass() {
> -            return
> List.class;
> -        }
> -
>      }
>  
> -    public static class ListToString extends
> AbstractConverter<List<?>, String> {
> +    public static class ListToString extends
> AbstractConverter<List, String> {
>  
> -        public String
> convert(List<?> obj) throws ConversionException {
> -            return
> obj.toString();
> -        }
> -
> -       
> @SuppressWarnings("unchecked")
> -        public Class<List>
> getSourceClass() {
> -            return
> List.class;
> +        public ListToString() {
> +           
> super(List.class, String.class);
>          }
>  
> -        public Class<String>
> getTargetClass() {
> -            return
> String.class;
> +        public String convert(List
> obj) throws ConversionException {
> +            return
> obj.toString();
>          }
>  
>      }
>  
> -    public static class MapToList extends
> AbstractConverter<Map<?, ?>,
> List<Map<?,?>>> {
> -
> -        public
> List<Map<?,?>> convert(Map<?, ?> obj)
> throws ConversionException {
> -           
> List<Map<?,?>> tempList =
> FastList.newInstance();
> -           
> tempList.add(obj);
> -            return
> tempList;
> -        }
> +    public static class MapToList extends
> AbstractCollectionConverter<Map, List<Map>> {
>  
> -       
> @SuppressWarnings("unchecked")
> -        public Class<Map>
> getSourceClass() {
> -            return
> Map.class;
> +        public MapToList() {
> +            super(Map.class,
> List.class);
>          }
>  
> -       
> @SuppressWarnings("unchecked")
> -        public Class<List>
> getTargetClass() {
> -            return
> List.class;
> +        public List<Map>
> convert(Map obj) throws ConversionException {
> +            List<Map>
> tempList = FastList.newInstance();
> +           
> tempList.add(obj);
> +            return
> tempList;
>          }
>  
>      }
>  
> -    public static class MapToSet extends
> AbstractConverter<Map<?, ?>,
> Set<Map<?,?>>> {
> +    public static class MapToSet extends
> AbstractCollectionConverter<Map, Set<Map>> {
>  
> -        public
> Set<Map<?,?>> convert(Map<?, ?> obj)
> throws ConversionException {
> -           
> Set<Map<?,?>> tempSet = FastSet.newInstance();
> -           
> tempSet.add(obj);
> -            return tempSet;
> -        }
> -
> -       
> @SuppressWarnings("unchecked")
> -        public Class<Map>
> getSourceClass() {
> -            return
> Map.class;
> +        public MapToSet() {
> +            super(Map.class,
> Set.class);
>          }
>  
> -       
> @SuppressWarnings("unchecked")
> -        public Class<Set>
> getTargetClass() {
> -            return
> Set.class;
> +        public Set<Map>
> convert(Map obj) throws ConversionException {
> +            Set<Map>
> tempSet = FastSet.newInstance();
> +           
> tempSet.add(obj);
> +            return tempSet;
>          }
>  
>      }
>  
> -    public static class MapToString extends
> AbstractConverter<Map<?, ?>, String> {
> +    public static class MapToString extends
> AbstractConverter<Map, String> {
>  
> -        public String
> convert(Map<?, ?> obj) throws ConversionException {
> -            return
> obj.toString();
> -        }
> -
> -       
> @SuppressWarnings("unchecked")
> -        public Class<Map>
> getSourceClass() {
> -            return
> Map.class;
> +        public MapToString() {
> +            super(Map.class,
> String.class);
>          }
>  
> -        public Class<String>
> getTargetClass() {
> -            return
> String.class;
> +        public String convert(Map obj)
> throws ConversionException {
> +            return
> obj.toString();
>          }
>  
>      }
>  
> -    public static class StringToList extends
> AbstractConverter<String, List<?>> {
> +    public static class StringToList extends
> AbstractCollectionConverter<String,
> List<String>> {
> +
> +        public StringToList() {
> +           
> super(String.class, List.class);
> +        }
>  
> -        public List<?>
> convert(String obj) throws ConversionException {
> +        public List<String>
> convert(String obj) throws ConversionException {
>              if
> (obj.startsWith("[") && obj.endsWith("]")) {
>              
>    return StringUtil.toList(obj);
>              } else
> {
> @@ -140,40 +118,30 @@
>              }
>          }
>  
> -        public Class<String>
> getSourceClass() {
> -            return
> String.class;
> -        }
> -
> -       
> @SuppressWarnings("unchecked")
> -        public Class<List>
> getTargetClass() {
> -            return
> List.class;
> -        }
> -
>      }
>  
> -    public static class StringToMap extends
> AbstractConverter<String, Map<?, ?>> {
> +    public static class StringToMap extends
> AbstractConverter<String, Map> {
> +
> +        public StringToMap() {
> +           
> super(String.class, Map.class);
> +        }
>  
> -        public Map<?, ?>
> convert(String obj) throws ConversionException {
> +        public Map convert(String obj)
> throws ConversionException {
>              if
> (obj.startsWith("{") && obj.endsWith("}")) {
>              
>    return StringUtil.toMap(obj);
>              }
>              throw
> new ConversionException("Could not convert " + obj + " to
> Map: ");
>          }
>  
> -        public Class<String>
> getSourceClass() {
> -            return
> String.class;
> -        }
> -
> -       
> @SuppressWarnings("unchecked")
> -        public Class<Map>
> getTargetClass() {
> -            return
> Map.class;
> -        }
> -
>      }
>  
> -    public static class StringToSet extends
> AbstractConverter<String, Set<?>> {
> +    public static class StringToSet extends
> AbstractCollectionConverter<String, Set<String>>
> {
>  
> -        public Set<?>
> convert(String obj) throws ConversionException {
> +        public StringToSet() {
> +           
> super(String.class, Set.class);
> +        }
> +
> +        public Set<String>
> convert(String obj) throws ConversionException {
>              if
> (obj.startsWith("[") && obj.endsWith("]")) {
>              
>    return StringUtil.toSet(obj);
>              } else
> {
> @@ -183,15 +151,6 @@
>              }
>          }
>  
> -        public Class<String>
> getSourceClass() {
> -            return
> String.class;
> -        }
> -
> -       
> @SuppressWarnings("unchecked")
> -        public Class<Set>
> getTargetClass() {
> -            return
> Set.class;
> -        }
> -
>      }
>  
>      public void loadConverters() {
> 
> Modified:
> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/DateTimeConverters.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/DateTimeConverters.java?rev=835164&r1=835163&r2=835164&view=diff
> ==============================================================================
> ---
> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/DateTimeConverters.java
> (original)
> +++
> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/DateTimeConverters.java
> Wed Nov 11 23:47:03 2009
> @@ -33,22 +33,22 @@
>  
>      public static class CalendarToLong
> extends AbstractConverter<Calendar, Long> {
>  
> -        public Long convert(Calendar
> obj) throws ConversionException {
> -            return
> obj.getTimeInMillis();
> +        public CalendarToLong() {
> +           
> super(Calendar.class, Long.class);
>          }
>  
> -        public Class<Calendar>
> getSourceClass() {
> -            return
> Calendar.class;
> -        }
> -
> -        public Class<Long>
> getTargetClass() {
> -            return
> Long.class;
> +        public Long convert(Calendar
> obj) throws ConversionException {
> +            return
> obj.getTimeInMillis();
>          }
>  
>      }
>  
>      public static class
> CalendarToString extends AbstractConverter<Calendar,
> String> {
>  
> +        public CalendarToString() {
> +           
> super(Calendar.class, String.class);
> +        }
> +
>          public String
> convert(Calendar obj) throws ConversionException {
>              Locale
> locale =
> obj.getLocale(com.ibm.icu.util.ULocale.VALID_LOCALE).toLocale();
>          
>    TimeZone timeZone =
> UtilDateTime.toTimeZone(obj.getTimeZone().getID());
> @@ -56,50 +56,38 @@
>              return
> df.format(obj);
>          }
>  
> -        public Class<Calendar>
> getSourceClass() {
> -            return
> Calendar.class;
> -        }
> -
> -        public Class<String>
> getTargetClass() {
> -            return
> String.class;
> -        }
> -
>      }
>  
>      public static class DateToLong
> extends AbstractConverter<java.util.Date, Long> {
>  
> -        public Long
> convert(java.util.Date obj) throws ConversionException {
> -         
>    return obj.getTime();
> -        }
> -
> -        public
> Class<java.util.Date> getSourceClass() {
> -            return
> java.util.Date.class;
> +        public DateToLong() {
> +           
> super(java.util.Date.class, Long.class);
>          }
>  
> -        public Class<Long>
> getTargetClass() {
> -            return
> Long.class;
> +        public Long
> convert(java.util.Date obj) throws ConversionException {
> +         
>    return obj.getTime();
>          }
>  
>      }
>  
>      public static class DateToSqlDate
> extends AbstractConverter<java.util.Date,
> java.sql.Date> {
>  
> -        public java.sql.Date
> convert(java.util.Date obj) throws ConversionException {
> -            return new
> java.sql.Date(obj.getTime());
> -        }
> -
> -        public
> Class<java.util.Date> getSourceClass() {
> -            return
> java.util.Date.class;
> +        public DateToSqlDate() {
> +           
> super(java.util.Date.class, java.sql.Date.class);
>          }
>  
> -        public
> Class<java.sql.Date> getTargetClass() {
> -            return
> java.sql.Date.class;
> +        public java.sql.Date
> convert(java.util.Date obj) throws ConversionException {
> +            return new
> java.sql.Date(obj.getTime());
>          }
>  
>      }
>  
>      public static class DateToString
> extends GenericLocalizedConverter<java.util.Date,
> String> {
>  
> +        public DateToString() {
> +           
> super(java.util.Date.class, String.class);
> +        }
> +
>          public String
> convert(java.util.Date obj, Locale locale, TimeZone
> timeZone, String formatString) throws ConversionException {
>          
>    DateFormat df = null;
>              if
> (formatString == null || formatString.length() == 0) {
> @@ -110,50 +98,38 @@
>              return
> df.format(obj);
>          }
>  
> -        public
> Class<java.util.Date> getSourceClass() {
> -            return
> java.util.Date.class;
> -        }
> -
> -        public Class<String>
> getTargetClass() {
> -            return
> String.class;
> -        }
> -
>      }
>  
>      public static class
> DateToTimestamp extends AbstractConverter<java.util.Date,
> java.sql.Timestamp> {
>  
> -        public java.sql.Timestamp
> convert(java.util.Date obj) throws ConversionException {
> -            return new
> java.sql.Timestamp(obj.getTime());
> +        public DateToTimestamp() {
> +           
> super(java.util.Date.class, java.sql.Timestamp.class);
>          }
>  
> -        public
> Class<java.util.Date> getSourceClass() {
> -            return
> java.util.Date.class;
> -        }
> -
> -        public
> Class<java.sql.Timestamp> getTargetClass() {
> -            return
> java.sql.Timestamp.class;
> +        public java.sql.Timestamp
> convert(java.util.Date obj) throws ConversionException {
> +            return new
> java.sql.Timestamp(obj.getTime());
>          }
>  
>      }
>  
>      public static class
> DurationToString extends AbstractConverter<TimeDuration,
> String> {
>  
> -        public String
> convert(TimeDuration obj) throws ConversionException {
> -         
>    return obj.toString();
> -        }
> -
> -        public
> Class<TimeDuration> getSourceClass() {
> -            return
> TimeDuration.class;
> +        public DurationToString() {
> +           
> super(TimeDuration.class, String.class);
>          }
>  
> -        public Class<String>
> getTargetClass() {
> -            return
> String.class;
> +        public String
> convert(TimeDuration obj) throws ConversionException {
> +         
>    return obj.toString();
>          }
>  
>      }
>  
>      public static abstract class
> GenericLocalizedConverter<S, T> extends
> AbstractLocalizedConverter<S, T> {
>  
> +        protected
> GenericLocalizedConverter(Class<S> sourceClass,
> Class<T> targetClass) {
> +           
> super(sourceClass, targetClass);
> +        }
> +
>          public T convert(S
> obj) throws ConversionException {
>              return
> convert(obj, Locale.getDefault(), TimeZone.getDefault(),
> null);
>          }
> @@ -166,6 +142,10 @@
>  
>      public static class LongToCalendar
> extends AbstractLocalizedConverter<Long, Calendar> {
>  
> +        public LongToCalendar() {
> +           
> super(Long.class, Calendar.class);
> +        }
> +
>          public Calendar
> convert(Long obj) throws ConversionException {
>              return
> convert(obj, Locale.getDefault(), TimeZone.getDefault());
>          }
> @@ -178,114 +158,86 @@
>              return
> convert(obj, Locale.getDefault(), TimeZone.getDefault());
>          }
>  
> -        public Class<Long>
> getSourceClass() {
> -            return
> Long.class;
> -        }
> -
> -        public Class<Calendar>
> getTargetClass() {
> -            return
> Calendar.class;
> -        }
> -
>      }
>  
>      public static class NumberToDate
> extends AbstractConverter<Number, java.util.Date> {
>  
> -        public java.util.Date
> convert(Number obj) throws ConversionException {
> -         
>    return new
> java.util.Date(obj.longValue());
> +        public NumberToDate() {
> +           
> super(Number.class, java.util.Date.class);
>          }
>  
> -        public Class<Number>
> getSourceClass() {
> -            return
> Number.class;
> -        }
> -
> -        public
> Class<java.util.Date> getTargetClass() {
> -            return
> java.util.Date.class;
> +        public java.util.Date
> convert(Number obj) throws ConversionException {
> +         
>    return new
> java.util.Date(obj.longValue());
>          }
>  
>      }
>  
>      public static class
> NumberToDuration extends AbstractConverter<Number,
> TimeDuration> {
>  
> -        public TimeDuration
> convert(Number obj) throws ConversionException {
> -         
>    return TimeDuration.fromNumber(obj);
> -        }
> -
> -        public Class<Number>
> getSourceClass() {
> -            return
> Number.class;
> +        public NumberToDuration() {
> +           
> super(Number.class, TimeDuration.class);
>          }
>  
> -        public
> Class<TimeDuration> getTargetClass() {
> -            return
> TimeDuration.class;
> +        public TimeDuration
> convert(Number obj) throws ConversionException {
> +         
>    return TimeDuration.fromNumber(obj);
>          }
>  
>      }
>  
>      public static class
> NumberToSqlDate extends AbstractConverter<Number,
> java.sql.Date> {
>  
> -        public java.sql.Date
> convert(Number obj) throws ConversionException {
> -         
>    return new
> java.sql.Date(obj.longValue());
> -        }
> -
> -        public Class<Number>
> getSourceClass() {
> -            return
> Number.class;
> +        public NumberToSqlDate() {
> +           
> super(Number.class, java.sql.Date.class);
>          }
>  
> -        public
> Class<java.sql.Date> getTargetClass() {
> -            return
> java.sql.Date.class;
> +        public java.sql.Date
> convert(Number obj) throws ConversionException {
> +         
>    return new
> java.sql.Date(obj.longValue());
>          }
>  
>      }
>  
>      public static class
> NumberToSqlTime extends AbstractConverter<Number,
> java.sql.Time> {
>  
> -        public java.sql.Time
> convert(Number obj) throws ConversionException {
> -         
>    return new
> java.sql.Time(obj.longValue());
> +        public NumberToSqlTime() {
> +           
> super(Number.class, java.sql.Time.class);
>          }
>  
> -        public Class<Number>
> getSourceClass() {
> -            return
> Number.class;
> -        }
> -
> -        public
> Class<java.sql.Time> getTargetClass() {
> -            return
> java.sql.Time.class;
> +        public java.sql.Time
> convert(Number obj) throws ConversionException {
> +         
>    return new
> java.sql.Time(obj.longValue());
>          }
>  
>      }
>  
>      public static class
> NumberToTimestamp extends AbstractConverter<Number,
> java.sql.Timestamp> {
>  
> -        public java.sql.Timestamp
> convert(Number obj) throws ConversionException {
> -         
>    return new
> java.sql.Timestamp(obj.longValue());
> -        }
> -
> -        public Class<Number>
> getSourceClass() {
> -            return
> Number.class;
> +        public NumberToTimestamp() {
> +           
> super(Number.class, java.sql.Timestamp.class);
>          }
>  
> -        public
> Class<java.sql.Timestamp> getTargetClass() {
> -            return
> java.sql.Timestamp.class;
> +        public java.sql.Timestamp
> convert(Number obj) throws ConversionException {
> +         
>    return new
> java.sql.Timestamp(obj.longValue());
>          }
>  
>      }
>  
>      public static class SqlDateToDate
> extends AbstractConverter<java.sql.Date,
> java.util.Date> {
>  
> -        public java.util.Date
> convert(java.sql.Date obj) throws ConversionException {
> -            return new
> java.util.Date(obj.getTime());
> -        }
> -
> -        public
> Class<java.sql.Date> getSourceClass() {
> -            return
> java.sql.Date.class;
> +        public SqlDateToDate() {
> +           
> super(java.sql.Date.class, java.util.Date.class);
>          }
>  
> -        public
> Class<java.util.Date> getTargetClass() {
> -            return
> java.util.Date.class;
> +        public java.util.Date
> convert(java.sql.Date obj) throws ConversionException {
> +            return new
> java.util.Date(obj.getTime());
>          }
>  
>      }
>  
>      public static class
> SqlDateToString extends
> GenericLocalizedConverter<java.sql.Date, String> {
>  
> +        public SqlDateToString() {
> +           
> super(java.sql.Date.class, String.class);
> +        }
> +
>          public String
> convert(java.sql.Date obj, Locale locale, TimeZone timeZone,
> String formatString) throws ConversionException {
>          
>    DateFormat df = null;
>              if
> (formatString == null || formatString.length() == 0) {
> @@ -296,18 +248,14 @@
>              return
> df.format(obj);
>          }
>  
> -        public
> Class<java.sql.Date> getSourceClass() {
> -            return
> java.sql.Date.class;
> -        }
> -
> -        public Class<String>
> getTargetClass() {
> -            return
> String.class;
> -        }
> -
>      }
>  
>      public static class
> SqlTimeToString extends
> GenericLocalizedConverter<java.sql.Time, String> {
>  
> +        public SqlTimeToString() {
> +           
> super(java.sql.Time.class, String.class);
> +        }
> +
>          public String
> convert(java.sql.Time obj, Locale locale, TimeZone timeZone,
> String formatString) throws ConversionException {
>          
>    DateFormat df = null;
>              if
> (formatString == null || formatString.length() == 0) {
> @@ -318,14 +266,6 @@
>              return
> df.format(obj);
>          }
>  
> -        public
> Class<java.sql.Time> getSourceClass() {
> -            return
> java.sql.Time.class;
> -        }
> -
> -        public Class<String>
> getTargetClass() {
> -            return
> String.class;
> -        }
> -
>      }
>  
>      public static class
> StringToCalendar extends
> AbstractLocalizedConverter<String, Calendar> {
> @@ -338,6 +278,10 @@
>              return
> convert(obj, Locale.getDefault(), TimeZone.getDefault(),
> null);
>          }
>  
> +        public StringToCalendar() {
> +           
> super(String.class, Calendar.class);
> +        }
> +
>          public Calendar
> convert(String obj, Locale locale, TimeZone timeZone, String
> formatString) throws ConversionException {
>              if
> (obj.length() == 0) {
>              
>    return null;
> @@ -356,18 +300,14 @@
>              }
>          }
>  
> -        public Class<String>
> getSourceClass() {
> -            return
> String.class;
> -        }
> -
> -        public Class<Calendar>
> getTargetClass() {
> -            return
> Calendar.class;
> -        }
> -
>      }
>  
>      public static class StringToDate
> extends GenericLocalizedConverter<String,
> java.util.Date> {
>  
> +        public StringToDate() {
> +           
> super(String.class, java.util.Date.class);
> +        }
> +
>          public
> java.util.Date convert(String obj, Locale locale, TimeZone
> timeZone, String formatString) throws ConversionException {
>              if
> (obj.length() == 0) {
>              
>    return null;
> @@ -385,34 +325,26 @@
>              }
>          }
>  
> -        public Class<String>
> getSourceClass() {
> -            return
> String.class;
> -        }
> -
> -        public
> Class<java.util.Date> getTargetClass() {
> -            return
> java.util.Date.class;
> -        }
> -
>      }
>  
>      public static class
> StringToDuration extends AbstractConverter<String,
> TimeDuration> {
>  
> -        public TimeDuration
> convert(String obj) throws ConversionException {
> -         
>    return TimeDuration.parseDuration(obj);
> -        }
> -
> -        public Class<String>
> getSourceClass() {
> -            return
> String.class;
> +        public StringToDuration() {
> +           
> super(String.class, TimeDuration.class);
>          }
>  
> -        public
> Class<TimeDuration> getTargetClass() {
> -            return
> TimeDuration.class;
> +        public TimeDuration
> convert(String obj) throws ConversionException {
> +         
>    return TimeDuration.parseDuration(obj);
>          }
>  
>      }
>  
>      public static class
> StringToSqlDate extends GenericLocalizedConverter<String,
> java.sql.Date> {
>  
> +        public StringToSqlDate() {
> +           
> super(String.class, java.sql.Date.class);
> +        }
> +
>          public java.sql.Date
> convert(String obj, Locale locale, TimeZone timeZone, String
> formatString) throws ConversionException {
>              if
> (obj.length() == 0) {
>              
>    return null;
> @@ -430,18 +362,14 @@
>              }
>          }
>  
> -        public Class<String>
> getSourceClass() {
> -            return
> String.class;
> -        }
> -
> -        public
> Class<java.sql.Date> getTargetClass() {
> -            return
> java.sql.Date.class;
> -        }
> -
>      }
>  
>      public static class
> StringToSqlTime extends GenericLocalizedConverter<String,
> java.sql.Time> {
>  
> +        public StringToSqlTime() {
> +           
> super(String.class, java.sql.Time.class);
> +        }
> +
>          public java.sql.Time
> convert(String obj, Locale locale, TimeZone timeZone, String
> formatString) throws ConversionException {
>              if
> (obj.length() == 0) {
>              
>    return null;
> @@ -459,18 +387,14 @@
>              }
>          }
>  
> -        public Class<String>
> getSourceClass() {
> -            return
> String.class;
> -        }
> -
> -        public
> Class<java.sql.Time> getTargetClass() {
> -            return
> java.sql.Time.class;
> -        }
> -
>      }
>  
>      public static class
> StringToTimestamp extends
> GenericLocalizedConverter<String, java.sql.Timestamp>
> {
>  
> +        public StringToTimestamp() {
> +           
> super(String.class, java.sql.Timestamp.class);
> +        }
> +
>          public
> java.sql.Timestamp convert(String obj, Locale locale,
> TimeZone timeZone, String formatString) throws
> ConversionException {
>              if
> (obj.length() == 0) {
>              
>    return null;
> @@ -488,18 +412,14 @@
>              }
>          }
>  
> -        public Class<String>
> getSourceClass() {
> -            return
> String.class;
> -        }
> -
> -        public
> Class<java.sql.Timestamp> getTargetClass() {
> -            return
> java.sql.Timestamp.class;
> -        }
> -
>      }
>  
>      public static class
> StringToTimeZone extends AbstractConverter<String,
> TimeZone> {
>  
> +        public StringToTimeZone() {
> +           
> super(String.class, TimeZone.class);
> +        }
> +
>          public TimeZone
> convert(String obj) throws ConversionException {
>          
>    TimeZone tz =
> UtilDateTime.toTimeZone(obj);
>              if (tz
> != null) {
> @@ -509,60 +429,40 @@
>              }
>          }
>  
> -        public Class<String>
> getSourceClass() {
> -            return
> String.class;
> -        }
> -
> -        public Class<TimeZone>
> getTargetClass() {
> -            return
> TimeZone.class;
> -        }
> -
>      }
>  
>      public static class
> TimestampToDate extends
> AbstractConverter<java.sql.Timestamp, java.util.Date>
> {
>  
> -        public java.util.Date
> convert(java.sql.Timestamp obj) throws ConversionException
> {
> -            return new
> java.sql.Timestamp(obj.getTime());
> -        }
> -
> -        public
> Class<java.sql.Timestamp> getSourceClass() {
> -            return
> java.sql.Timestamp.class;
> +        public TimestampToDate() {
> +           
> super(java.sql.Timestamp.class, java.util.Date.class);
>          }
>  
> -        public
> Class<java.util.Date> getTargetClass() {
> -            return
> java.util.Date.class;
> +        public java.util.Date
> convert(java.sql.Timestamp obj) throws ConversionException
> {
> +            return new
> java.sql.Timestamp(obj.getTime());
>          }
>  
>      }
>  
>      public static class
> TimestampToSqlDate extends
> AbstractConverter<java.sql.Timestamp, java.sql.Date>
> {
>  
> -        public java.sql.Date
> convert(java.sql.Timestamp obj) throws ConversionException
> {
> -            return new
> java.sql.Date(obj.getTime());
> +        public TimestampToSqlDate() {
> +           
> super(java.sql.Timestamp.class, java.sql.Date.class);
>          }
>  
> -        public
> Class<java.sql.Timestamp> getSourceClass() {
> -            return
> java.sql.Timestamp.class;
> -        }
> -
> -        public
> Class<java.sql.Date> getTargetClass() {
> -            return
> java.sql.Date.class;
> +        public java.sql.Date
> convert(java.sql.Timestamp obj) throws ConversionException
> {
> +            return new
> java.sql.Date(obj.getTime());
>          }
>  
>      }
>  
>      public static class
> TimeZoneToString extends AbstractConverter<TimeZone,
> String> {
>  
> -        public String convert(TimeZone
> obj) throws ConversionException {
> -            return
> obj.getID();
> +        public TimeZoneToString() {
> +           
> super(TimeZone.class, String.class);
>          }
>  
> -        public Class<TimeZone>
> getSourceClass() {
> -            return
> TimeZone.class;
> -        }
> -
> -        public Class<String>
> getTargetClass() {
> -            return
> String.class;
> +        public String convert(TimeZone
> obj) throws ConversionException {
> +            return
> obj.getID();
>          }
>  
>      }
> 
> Modified:
> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/MiscConverters.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/MiscConverters.java?rev=835164&r1=835163&r2=835164&view=diff
> ==============================================================================
> ---
> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/MiscConverters.java
> (original)
> +++
> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/MiscConverters.java
> Wed Nov 11 23:47:03 2009
> @@ -32,6 +32,10 @@
>  
>      public static class ClobToString
> extends AbstractConverter<Clob, String> {
>  
> +        public ClobToString() {
> +           
> super(Clob.class, String.class);
> +        }
> +
>          public String
> convert(Clob obj) throws ConversionException {
>          
>    StringBuilder strBuf = new
> StringBuilder();
>              char[]
> inCharBuffer = new char[CHAR_BUFFER_SIZE];
> @@ -55,34 +59,26 @@
>              return
> strBuf.toString();
>          }
>  
> -        public Class<Clob>
> getSourceClass() {
> -            return
> Clob.class;
> -        }
> -
> -        public Class<String>
> getTargetClass() {
> -            return
> String.class;
> -        }
> -
>      }
>  
>      public static class LocaleToString
> extends AbstractConverter<Locale, String> {
>  
> -        public String convert(Locale
> obj) throws ConversionException {
> -         
>    return obj.toString();
> -        }
> -
> -        public Class<Locale>
> getSourceClass() {
> -            return
> Locale.class;
> +        public LocaleToString() {
> +           
> super(Locale.class, String.class);
>          }
>  
> -        public Class<String>
> getTargetClass() {
> -            return
> String.class;
> +        public String convert(Locale
> obj) throws ConversionException {
> +         
>    return obj.toString();
>          }
>  
>      }
>  
>      public static class StringToLocale
> extends AbstractConverter<String, Locale> {
>  
> +        public StringToLocale() {
> +           
> super(String.class, Locale.class);
> +        }
> +
>          public Locale
> convert(String obj) throws ConversionException {
>              Locale
> loc = UtilMisc.parseLocale(obj);
>              if
> (loc != null) {
> @@ -92,14 +88,6 @@
>              }
>          }
>  
> -        public Class<String>
> getSourceClass() {
> -            return
> String.class;
> -        }
> -
> -        public Class<Locale>
> getTargetClass() {
> -            return
> Locale.class;
> -        }
> -
>      }
>  
>      public void loadConverters() {
> 
> Modified:
> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/NumberConverters.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/NumberConverters.java?rev=835164&r1=835163&r2=835164&view=diff
> ==============================================================================
> ---
> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/NumberConverters.java
> (original)
> +++
> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/NumberConverters.java
> Wed Nov 11 23:47:03 2009
> @@ -36,6 +36,10 @@
>  
>      public static abstract class
> AbstractToNumberConverter<S, T> extends
> AbstractUsesLocaleConverter<S, T> {
>  
> +        protected
> AbstractToNumberConverter(Class<S> sourceClass,
> Class<T> targetClass) {
> +           
> super(sourceClass, targetClass);
> +        }
> +
>          protected Number
> fromString(String str, Locale locale) throws
> ConversionException {
>          
>    NumberFormat nf =
> NumberFormat.getNumberInstance(locale);
>              try {
> @@ -49,6 +53,10 @@
>  
>      public static abstract class
> AbstractUsesLocaleConverter<S, T> extends
> AbstractLocalizedConverter<S, T> {
>  
> +        protected
> AbstractUsesLocaleConverter(Class<S> sourceClass,
> Class<T> targetClass) {
> +           
> super(sourceClass, targetClass);
> +        }
> +
>          public T convert(S
> obj) throws ConversionException {
>              return
> convert(obj, Locale.getDefault(), null);
>          }
> @@ -62,665 +70,505 @@
>  
>      public static class
> BigDecimalToDouble extends AbstractConverter<BigDecimal,
> Double> {
>  
> -        public Double
> convert(BigDecimal obj) throws ConversionException {
> -            return
> Double.valueOf(obj.doubleValue());
> -        }
> -
> -        public Class<BigDecimal>
> getSourceClass() {
> -            return
> BigDecimal.class;
> +        public BigDecimalToDouble() {
> +           
> super(BigDecimal.class, Double.class);
>          }
>  
> -        public Class<Double>
> getTargetClass() {
> -            return
> Double.class;
> +        public Double
> convert(BigDecimal obj) throws ConversionException {
> +            return
> Double.valueOf(obj.doubleValue());
>          }
>          
>      }
>  
>      public static class
> BigDecimalToFloat extends AbstractConverter<BigDecimal,
> Float> {
>  
> -        public Float
> convert(BigDecimal obj) throws ConversionException {
> -            return
> Float.valueOf(obj.floatValue());
> -        }
> -
> -        public Class<BigDecimal>
> getSourceClass() {
> -            return
> BigDecimal.class;
> +        public BigDecimalToFloat() {
> +           
> super(BigDecimal.class, Float.class);
>          }
>  
> -        public Class<Float>
> getTargetClass() {
> -            return
> Float.class;
> +        public Float
> convert(BigDecimal obj) throws ConversionException {
> +            return
> Float.valueOf(obj.floatValue());
>          }
>          
>      }
>  
>      public static class
> BigDecimalToInteger extends AbstractConverter<BigDecimal,
> Integer> {
>  
> -        public Integer
> convert(BigDecimal obj) throws ConversionException {
> -            return
> Integer.valueOf(obj.intValue());
> -        }
> -
> -        public Class<BigDecimal>
> getSourceClass() {
> -            return
> BigDecimal.class;
> +        public BigDecimalToInteger()
> {
> +           
> super(BigDecimal.class, Integer.class);
>          }
>  
> -        public Class<Integer>
> getTargetClass() {
> -            return
> Integer.class;
> +        public Integer
> convert(BigDecimal obj) throws ConversionException {
> +            return
> Integer.valueOf(obj.intValue());
>          }
>          
>      }
>  
> -    public static class BigDecimalToList extends
> AbstractConverter<BigDecimal, List<BigDecimal>>
> {
> +    public static class BigDecimalToList extends
> AbstractCollectionConverter<BigDecimal,
> List<BigDecimal>> {
> +
> +        public BigDecimalToList() {
> +           
> super(BigDecimal.class, List.class);
> +        }
>  
>          public
> List<BigDecimal> convert(BigDecimal obj) throws
> ConversionException {
>          
>    List<BigDecimal> tempList =
> FastList.newInstance();
>          
>    tempList.add(obj);
>              return
> tempList;
>          }
> -
> -        public Class<BigDecimal>
> getSourceClass() {
> -            return
> BigDecimal.class;
> -        }
> -
> -        public Class<?>
> getTargetClass() {
> -            return
> List.class;
> -        }
>          
>      }
>  
>      public static class
> BigDecimalToLong extends AbstractConverter<BigDecimal,
> Long> {
>  
> -        public Long convert(BigDecimal
> obj) throws ConversionException {
> -            return
> Long.valueOf(obj.longValue());
> +        public BigDecimalToLong() {
> +           
> super(BigDecimal.class, Long.class);
>          }
>  
> -        public Class<BigDecimal>
> getSourceClass() {
> -            return
> BigDecimal.class;
> -        }
> -
> -        public Class<Long>
> getTargetClass() {
> -            return
> Long.class;
> +        public Long convert(BigDecimal
> obj) throws ConversionException {
> +            return
> Long.valueOf(obj.longValue());
>          }
>          
>      }
>  
> -    public static class BigDecimalToSet extends
> AbstractConverter<BigDecimal, Set<BigDecimal>>
> {
> +    public static class BigDecimalToSet extends
> AbstractCollectionConverter<BigDecimal,
> Set<BigDecimal>> {
> +
> +        public BigDecimalToSet() {
> +           
> super(BigDecimal.class, Set.class);
> +        }
>  
>          public
> Set<BigDecimal> convert(BigDecimal obj) throws
> ConversionException {
>          
>    Set<BigDecimal> tempSet =
> FastSet.newInstance();
>          
>    tempSet.add(obj);
>              return
> tempSet;
>          }
> -
> -        public Class<BigDecimal>
> getSourceClass() {
> -            return
> BigDecimal.class;
> -        }
> -
> -        public Class<?>
> getTargetClass() {
> -            return
> Set.class;
> -        }
>          
>      }
>  
>      public static class
> BigDecimalToString extends
> AbstractUsesLocaleConverter<BigDecimal, String> {
>  
> +        public BigDecimalToString() {
> +           
> super(BigDecimal.class, String.class);
> +        }
> +
>          public String
> convert(BigDecimal obj, Locale locale, TimeZone timeZone)
> throws ConversionException {
>          
>    NumberFormat nf =
> NumberFormat.getNumberInstance(locale);
>              return
> nf.format(obj.doubleValue());
>          }
> -
> -        public Class<BigDecimal>
> getSourceClass() {
> -            return
> BigDecimal.class;
> -        }
> -
> -        public Class<String>
> getTargetClass() {
> -            return
> String.class;
> -        }
>          
>      }
>  
>      public static class
> DoubleToBigDecimal extends AbstractConverter<Double,
> BigDecimal> {
>  
> -        public BigDecimal
> convert(Double obj) throws ConversionException {
> -            return
> BigDecimal.valueOf(obj.doubleValue());
> -        }
> -
> -        public Class<Double>
> getSourceClass() {
> -            return
> Double.class;
> +        public DoubleToBigDecimal() {
> +           
> super(Double.class, BigDecimal.class);
>          }
>  
> -        public Class<BigDecimal>
> getTargetClass() {
> -            return
> BigDecimal.class;
> +        public BigDecimal
> convert(Double obj) throws ConversionException {
> +            return
> BigDecimal.valueOf(obj.doubleValue());
>          }
>          
>      }
>  
>      public static class DoubleToFloat
> extends AbstractConverter<Double, Float> {
>  
> -        public Float convert(Double
> obj) throws ConversionException {
> -            return
> Float.valueOf(obj.floatValue());
> +        public DoubleToFloat() {
> +           
> super(Double.class, Float.class);
>          }
>  
> -        public Class<Double>
> getSourceClass() {
> -            return
> Double.class;
> -        }
> -
> -        public Class<Float>
> getTargetClass() {
> -            return
> Float.class;
> +        public Float convert(Double
> obj) throws ConversionException {
> +            return
> Float.valueOf(obj.floatValue());
>          }
>          
>      }
>  
>      public static class
> DoubleToInteger extends AbstractConverter<Double,
> Integer> {
>  
> -        public Integer convert(Double
> obj) throws ConversionException {
> -            return
> Integer.valueOf(obj.intValue());
> -        }
> -
> -        public Class<Double>
> getSourceClass() {
> -            return
> Double.class;
> +        public DoubleToInteger() {
> +           
> super(Double.class, Integer.class);
>          }
>  
> -        public Class<Integer>
> getTargetClass() {
> -            return
> Integer.class;
> +        public Integer convert(Double
> obj) throws ConversionException {
> +            return
> Integer.valueOf(obj.intValue());
>          }
>          
>      }
>  
> -    public static class DoubleToList extends
> AbstractConverter<Double, List<Double>> {
> +    public static class DoubleToList extends
> AbstractCollectionConverter<Double,
> List<Double>> {
> +
> +        public DoubleToList() {
> +           
> super(Double.class, List.class);
> +        }
>  
>          public
> List<Double> convert(Double obj) throws
> ConversionException {
>          
>    List<Double> tempList =
> FastList.newInstance();
>          
>    tempList.add(obj);
>              return
> tempList;
>          }
> -
> -        public Class<Double>
> getSourceClass() {
> -            return
> Double.class;
> -        }
> -
> -        public Class<?>
> getTargetClass() {
> -            return
> List.class;
> -        }
>          
>      }
>  
>      public static class DoubleToLong
> extends AbstractConverter<Double, Long> {
>  
> -        public Long convert(Double
> obj) throws ConversionException {
> -            return
> Long.valueOf(obj.longValue());
> -        }
> -
> -        public Class<Double>
> getSourceClass() {
> -            return
> Double.class;
> +        public DoubleToLong() {
> +           
> super(Double.class, Long.class);
>          }
>  
> -        public Class<Long>
> getTargetClass() {
> -            return
> Long.class;
> +        public Long convert(Double
> obj) throws ConversionException {
> +            return
> Long.valueOf(obj.longValue());
>          }
>          
>      }
>  
> -    public static class DoubleToSet extends
> AbstractConverter<Double, Set<Double>> {
> +    public static class DoubleToSet extends
> AbstractCollectionConverter<Double, Set<Double>>
> {
> +
> +        public DoubleToSet() {
> +           
> super(Double.class, Set.class);
> +        }
>  
>          public
> Set<Double> convert(Double obj) throws
> ConversionException {
>          
>    Set<Double> tempSet =
> FastSet.newInstance();
>          
>    tempSet.add(obj);
>              return
> tempSet;
>          }
> -
> -        public Class<Double>
> getSourceClass() {
> -            return
> Double.class;
> -        }
> -
> -        public Class<?>
> getTargetClass() {
> -            return
> Set.class;
> -        }
>          
>      }
>  
>      public static class DoubleToString
> extends AbstractUsesLocaleConverter<Double, String> {
>  
> +        public DoubleToString() {
> +           
> super(Double.class, String.class);
> +        }
> +
>          public String
> convert(Double obj, Locale locale, TimeZone timeZone) throws
> ConversionException {
>          
>    NumberFormat nf =
> NumberFormat.getNumberInstance(locale);
>              return
> nf.format(obj.doubleValue());
>          }
> -
> -        public Class<Double>
> getSourceClass() {
> -            return
> Double.class;
> -        }
> -
> -        public Class<String>
> getTargetClass() {
> -            return
> String.class;
> -        }
>          
>      }
>  
>      public static class
> FloatToBigDecimal extends AbstractConverter<Float,
> BigDecimal> {
>  
> -        public BigDecimal
> convert(Float obj) throws ConversionException {
> -            return
> BigDecimal.valueOf(obj.doubleValue());
> -        }
> -
> -        public Class<Float>
> getSourceClass() {
> -            return
> Float.class;
> +        public FloatToBigDecimal() {
> +           
> super(Float.class, BigDecimal.class);
>          }
>  
> -        public Class<BigDecimal>
> getTargetClass() {
> -            return
> BigDecimal.class;
> +        public BigDecimal
> convert(Float obj) throws ConversionException {
> +            return
> BigDecimal.valueOf(obj.doubleValue());
>          }
>          
>      }
>  
>      public static class FloatToDouble
> extends AbstractConverter<Float, Double> {
>  
> -        public Double convert(Float
> obj) throws ConversionException {
> -            return
> Double.valueOf(obj.doubleValue());
> -        }
> -
> -        public Class<Float>
> getSourceClass() {
> -            return
> Float.class;
> +        public FloatToDouble() {
> +           
> super(Float.class, Double.class);
>          }
>  
> -        public Class<Double>
> getTargetClass() {
> -            return
> Double.class;
> +        public Double convert(Float
> obj) throws ConversionException {
> +            return
> Double.valueOf(obj.doubleValue());
>          }
>          
>      }
>  
>      public static class FloatToInteger
> extends AbstractConverter<Float, Integer> {
>  
> -        public Integer convert(Float
> obj) throws ConversionException {
> -            return
> Integer.valueOf(obj.intValue());
> -        }
> -
> -        public Class<Float>
> getSourceClass() {
> -            return
> Float.class;
> +        public FloatToInteger() {
> +           
> super(Float.class, Integer.class);
>          }
>  
> -        public Class<Integer>
> getTargetClass() {
> -            return
> Integer.class;
> +        public Integer convert(Float
> obj) throws ConversionException {
> +            return
> Integer.valueOf(obj.intValue());
>          }
>          
>      }
>  
> -    public static class FloatToList extends
> AbstractConverter<Float, List<Float>> {
> +    public static class FloatToList extends
> AbstractCollectionConverter<Float, List<Float>>
> {
> +
> +        public FloatToList() {
> +           
> super(Float.class, List.class);
> +        }
>  
>          public
> List<Float> convert(Float obj) throws
> ConversionException {
>          
>    List<Float> tempList =
> FastList.newInstance();
>          
>    tempList.add(obj);
>              return
> tempList;
>          }
> -
> -        public Class<Float>
> getSourceClass() {
> -            return
> Float.class;
> -        }
> -
> -        public Class<?>
> getTargetClass() {
> -            return
> List.class;
> -        }
>          
>      }
>  
>      public static class FloatToLong
> extends AbstractConverter<Float, Long> {
>  
> -        public Long convert(Float obj)
> throws ConversionException {
> -            return
> Long.valueOf(obj.longValue());
> +        public FloatToLong() {
> +           
> super(Float.class, Long.class);
>          }
>  
> -        public Class<Float>
> getSourceClass() {
> -            return
> Float.class;
> -        }
> -
> -        public Class<Long>
> getTargetClass() {
> -            return
> Long.class;
> +        public Long convert(Float obj)
> throws ConversionException {
> +            return
> Long.valueOf(obj.longValue());
>          }
>          
>      }
>  
> -    public static class FloatToSet extends
> AbstractConverter<Float, Set<Float>> {
> +    public static class FloatToSet extends
> AbstractCollectionConverter<Float, Set<Float>>
> {
> +
> +        public FloatToSet() {
> +           
> super(Float.class, Set.class);
> +        }
>  
>          public
> Set<Float> convert(Float obj) throws
> ConversionException {
>          
>    Set<Float> tempSet =
> FastSet.newInstance();
>          
>    tempSet.add(obj);
>              return
> tempSet;
>          }
> -
> -        public Class<Float>
> getSourceClass() {
> -            return
> Float.class;
> -        }
> -
> -        public Class<?>
> getTargetClass() {
> -            return
> Set.class;
> -        }
>          
>      }
>  
>      public static class FloatToString
> extends AbstractUsesLocaleConverter<Float, String> {
>  
> +        public FloatToString() {
> +           
> super(Float.class, String.class);
> +        }
> +
>          public String
> convert(Float obj, Locale locale, TimeZone timeZone) throws
> ConversionException {
>          
>    NumberFormat nf =
> NumberFormat.getNumberInstance(locale);
>              return
> nf.format(obj.floatValue());
>          }
> -
> -        public Class<Float>
> getSourceClass() {
> -            return
> Float.class;
> -        }
> -
> -        public Class<String>
> getTargetClass() {
> -            return
> String.class;
> -        }
>          
>      }
>  
>      public static class
> IntegerToBigDecimal extends AbstractConverter<Integer,
> BigDecimal> {
>  
> -        public BigDecimal
> convert(Integer obj) throws ConversionException {
> -            return
> BigDecimal.valueOf(obj.doubleValue());
> -        }
> -
> -        public Class<Integer>
> getSourceClass() {
> -            return
> Integer.class;
> +        public IntegerToBigDecimal()
> {
> +           
> super(Integer.class, BigDecimal.class);
>          }
>  
> -        public Class<BigDecimal>
> getTargetClass() {
> -            return
> BigDecimal.class;
> +        public BigDecimal
> convert(Integer obj) throws ConversionException {
> +            return
> BigDecimal.valueOf(obj.doubleValue());
>          }
>          
>      }
>  
>      public static class
> IntegerToDouble extends AbstractConverter<Integer,
> Double> {
>  
> -        public Double convert(Integer
> obj) throws ConversionException {
> -            return
> Double.valueOf(obj.doubleValue());
> +        public IntegerToDouble() {
> +           
> super(Integer.class, Double.class);
>          }
>  
> -        public Class<Integer>
> getSourceClass() {
> -            return
> Integer.class;
> -        }
> -
> -        public Class<Double>
> getTargetClass() {
> -            return
> Double.class;
> +        public Double convert(Integer
> obj) throws ConversionException {
> +            return
> Double.valueOf(obj.doubleValue());
>          }
>          
>      }
>  
>      public static class IntegerToFloat
> extends AbstractConverter<Integer, Float> {
>  
> -        public Float convert(Integer
> obj) throws ConversionException {
> -            return
> Float.valueOf(obj.floatValue());
> -        }
> -
> -        public Class<Integer>
> getSourceClass() {
> -            return
> Integer.class;
> +        public IntegerToFloat() {
> +           
> super(Integer.class, Float.class);
>          }
>  
> -        public Class<Float>
> getTargetClass() {
> -            return
> Float.class;
> +        public Float convert(Integer
> obj) throws ConversionException {
> +            return
> Float.valueOf(obj.floatValue());
>          }
>          
>      }
>  
> -    public static class IntegerToList extends
> AbstractConverter<Integer, List<Integer>> {
> +    public static class IntegerToList extends
> AbstractCollectionConverter<Integer,
> List<Integer>> {
> +
> +        public IntegerToList() {
> +           
> super(Integer.class, List.class);
> +        }
>  
>          public
> List<Integer> convert(Integer obj) throws
> ConversionException {
>          
>    List<Integer> tempList =
> FastList.newInstance();
>          
>    tempList.add(obj);
>              return
> tempList;
>          }
> -
> -        public Class<Integer>
> getSourceClass() {
> -            return
> Integer.class;
> -        }
> -
> -        public Class<?>
> getTargetClass() {
> -            return
> List.class;
> -        }
>          
>      }
>  
>      public static class IntegerToLong
> extends AbstractConverter<Integer, Long> {
>  
> -        public Long convert(Integer
> obj) throws ConversionException {
> -            return
> Long.valueOf(obj.longValue());
> -        }
> -
> -        public Class<Integer>
> getSourceClass() {
> -            return
> Integer.class;
> +        public IntegerToLong() {
> +           
> super(Integer.class, Long.class);
>          }
>  
> -        public Class<Long>
> getTargetClass() {
> -            return
> Long.class;
> +        public Long convert(Integer
> obj) throws ConversionException {
> +            return
> Long.valueOf(obj.longValue());
>          }
>          
>      }
>  
> -    public static class IntegerToSet extends
> AbstractConverter<Integer, Set<Integer>> {
> +    public static class IntegerToSet extends
> AbstractCollectionConverter<Integer,
> Set<Integer>> {
> +
> +        public IntegerToSet() {
> +           
> super(Integer.class, Set.class);
> +        }
>  
>          public
> Set<Integer> convert(Integer obj) throws
> ConversionException {
>          
>    Set<Integer> tempSet =
> FastSet.newInstance();
>          
>    tempSet.add(obj);
>              return
> tempSet;
>          }
> -
> -        public Class<Integer>
> getSourceClass() {
> -            return
> Integer.class;
> -        }
> -
> -        public Class<?>
> getTargetClass() {
> -            return
> Set.class;
> -        }
>          
>      }
>  
>      public static class
> IntegerToString extends
> AbstractUsesLocaleConverter<Integer, String> {
>  
> +        public IntegerToString() {
> +           
> super(Integer.class, String.class);
> +        }
> +
>          public String
> convert(Integer obj, Locale locale, TimeZone timeZone)
> throws ConversionException {
>          
>    NumberFormat nf =
> NumberFormat.getNumberInstance(locale);
>              return
> nf.format(obj.intValue());
>          }
> -
> -        public Class<Integer>
> getSourceClass() {
> -            return
> Integer.class;
> -        }
> -
> -        public Class<String>
> getTargetClass() {
> -            return
> String.class;
> -        }
>          
>      }
>  
>      public static class
> LongToBigDecimal extends AbstractConverter<Long,
> BigDecimal> {
>  
> -        public BigDecimal convert(Long
> obj) throws ConversionException {
> -            return
> BigDecimal.valueOf(obj.doubleValue());
> -        }
> -
> -        public Class<Long>
> getSourceClass() {
> -            return
> Long.class;
> +        public LongToBigDecimal() {
> +           
> super(Long.class, BigDecimal.class);
>          }
>  
> -        public Class<BigDecimal>
> getTargetClass() {
> -            return
> BigDecimal.class;
> +        public BigDecimal convert(Long
> obj) throws ConversionException {
> +            return
> BigDecimal.valueOf(obj.doubleValue());
>          }
>          
>      }
>  
>      public static class LongToDouble
> extends AbstractConverter<Long, Double> {
>  
> -        public Double convert(Long
> obj) throws ConversionException {
> -            return
> Double.valueOf(obj.doubleValue());
> +        public LongToDouble() {
> +           
> super(Long.class, Double.class);
>          }
>  
> -        public Class<Long>
> getSourceClass() {
> -            return
> Long.class;
> -        }
> -
> -        public Class<Double>
> getTargetClass() {
> -            return
> Double.class;
> +        public Double convert(Long
> obj) throws ConversionException {
> +            return
> Double.valueOf(obj.doubleValue());
>          }
>          
>      }
>  
>      public static class LongToFloat
> extends AbstractConverter<Long, Float> {
>  
> -        public Float convert(Long obj)
> throws ConversionException {
> -            return
> Float.valueOf(obj.floatValue());
> -        }
> -
> -        public Class<Long>
> getSourceClass() {
> -            return
> Long.class;
> +        public LongToFloat() {
> +           
> super(Long.class, Float.class);
>          }
>  
> -        public Class<Float>
> getTargetClass() {
> -            return
> Float.class;
> +        public Float convert(Long obj)
> throws ConversionException {
> +            return
> Float.valueOf(obj.floatValue());
>          }
>          
>      }
>  
>      public static class LongToInteger
> extends AbstractConverter<Long, Integer> {
>  
> -        public Integer convert(Long
> obj) throws ConversionException {
> -            return
> Integer.valueOf(obj.intValue());
> -        }
> -
> -        public Class<Long>
> getSourceClass() {
> -            return
> Long.class;
> +        public LongToInteger() {
> +           
> super(Long.class, Integer.class);
>          }
>  
> -        public Class<Integer>
> getTargetClass() {
> -            return
> Integer.class;
> +        public Integer convert(Long
> obj) throws ConversionException {
> +            return
> Integer.valueOf(obj.intValue());
>          }
>          
>      }
>  
> -    public static class LongToList extends
> AbstractConverter<Long, List<Long>> {
> +    public static class LongToList extends
> AbstractCollectionConverter<Long, List<Long>> {
> +
> +        public LongToList() {
> +           
> super(Long.class, List.class);
> +        }
>  
>          public
> List<Long> convert(Long obj) throws
> ConversionException {
>          
>    List<Long> tempList =
> FastList.newInstance();
>          
>    tempList.add(obj);
>              return
> tempList;
>          }
> -
> -        public Class<Long>
> getSourceClass() {
> -            return
> Long.class;
> -        }
> -
> -        public Class<?>
> getTargetClass() {
> -            return
> List.class;
> -        }
>          
>      }
>  
> -    public static class LongToSet extends
> AbstractConverter<Long, Set<Long>> {
> +    public static class LongToSet extends
> AbstractCollectionConverter<Long, Set<Long>> {
> +
> +        public LongToSet() {
> +           
> super(Long.class, Set.class);
> +        }
>  
>          public
> Set<Long> convert(Long obj) throws ConversionException
> {
>          
>    Set<Long> tempSet =
> FastSet.newInstance();
>          
>    tempSet.add(obj);
>              return
> tempSet;
>          }
> -
> -        public Class<Long>
> getSourceClass() {
> -            return
> Long.class;
> -        }
> -
> -        public Class<?>
> getTargetClass() {
> -            return
> Set.class;
> -        }
>          
>      }
>  
>      public static class LongToString
> extends AbstractUsesLocaleConverter<Long, String> {
>  
> +        public LongToString() {
> +           
> super(Long.class, String.class);
> +        }
> +
>          public String
> convert(Long obj, Locale locale, TimeZone timeZone) throws
> ConversionException {
>          
>    NumberFormat nf =
> NumberFormat.getNumberInstance(locale);
>              return
> nf.format(obj.longValue());
>          }
> -
> -        public Class<Long>
> getSourceClass() {
> -            return
> Long.class;
> -        }
> -
> -        public Class<String>
> getTargetClass() {
> -            return
> String.class;
> -        }
>          
>      }
>  
>      public static class
> StringToBigDecimal extends
> AbstractToNumberConverter<String, BigDecimal> {
>  
> -        public BigDecimal
> convert(String obj, Locale locale, TimeZone timeZone) throws
> ConversionException {
> -            return
> BigDecimal.valueOf(this.fromString(obj,
> locale).doubleValue());
> -        }
> -
> -        public Class<String>
> getSourceClass() {
> -            return
> String.class;
> +        public StringToBigDecimal() {
> +           
> super(String.class, BigDecimal.class);
>          }
>  
> -        public Class<BigDecimal>
> getTargetClass() {
> -            return
> BigDecimal.class;
> +        public BigDecimal
> convert(String obj, Locale locale, TimeZone timeZone) throws
> ConversionException {
> +            return
> BigDecimal.valueOf(this.fromString(obj,
> locale).doubleValue());
>          }
>          
>      }
>  
>      public static class StringToDouble
> extends AbstractToNumberConverter<String, Double> {
>  
> -        public Double convert(String
> obj, Locale locale, TimeZone timeZone) throws
> ConversionException {
> -            return
> this.fromString(obj, locale).doubleValue();
> +        public StringToDouble() {
> +           
> super(String.class, Double.class);
>          }
>  
> -        public Class<String>
> getSourceClass() {
> -            return
> String.class;
> -        }
> -
> -        public Class<Double>
> getTargetClass() {
> -            return
> Double.class;
> +        public Double convert(String
> obj, Locale locale, TimeZone timeZone) throws
> ConversionException {
> +            return
> this.fromString(obj, locale).doubleValue();
>          }
>          
>      }
>  
>      public static class StringToFloat
> extends AbstractToNumberConverter<String, Float> {
>  
> -        public Float convert(String
> obj, Locale locale, TimeZone timeZone) throws
> ConversionException {
> -            return
> this.fromString(obj, locale).floatValue();
> -        }
> -
> -        public Class<String>
> getSourceClass() {
> -            return
> String.class;
> +        public StringToFloat() {
> +           
> super(String.class, Float.class);
>          }
>  
> -        public Class<Float>
> getTargetClass() {
> -            return
> Float.class;
> +        public Float convert(String
> obj, Locale locale, TimeZone timeZone) throws
> ConversionException {
> +            return
> this.fromString(obj, locale).floatValue();
>          }
>          
>      }
>  
>      public static class
> StringToInteger extends AbstractToNumberConverter<String,
> Integer> {
>  
> -        public Integer convert(String
> obj, Locale locale, TimeZone timeZone) throws
> ConversionException {
> -            return
> this.fromString(obj, locale).intValue();
> -        }
> -
> -        public Class<String>
> getSourceClass() {
> -            return
> String.class;
> +        public StringToInteger() {
> +           
> super(String.class, Integer.class);
>          }
>  
> -        public Class<Integer>
> getTargetClass() {
> -            return
> Integer.class;
> +        public Integer convert(String
> obj, Locale locale, TimeZone timeZone) throws
> ConversionException {
> +            return
> this.fromString(obj, locale).intValue();
>          }
>          
>      }
>  
>      public static class StringToLong
> extends AbstractToNumberConverter<String, Long> {
>  
> -        public Long convert(String
> obj, Locale locale, TimeZone timeZone) throws
> ConversionException {
> -            return
> this.fromString(obj, locale).longValue();
> +        public StringToLong() {
> +           
> super(String.class, Long.class);
>          }
>  
> -        public Class<String>
> getSourceClass() {
> -            return
> String.class;
> -        }
> -
> -        public Class<Long>
> getTargetClass() {
> -            return
> Long.class;
> +        public Long convert(String
> obj, Locale locale, TimeZone timeZone) throws
> ConversionException {
> +            return
> this.fromString(obj, locale).longValue();
>          }
>          
>      }
> 
> Modified:
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/Converters.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/Converters.java?rev=835164&r1=835163&r2=835164&view=diff
> ==============================================================================
> ---
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/Converters.java
> (original)
> +++
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/Converters.java
> Wed Nov 11 23:47:03 2009
> @@ -25,6 +25,7 @@
>  import javolution.util.FastSet;
>  
>  import org.ofbiz.base.conversion.AbstractConverter;
> +import
> org.ofbiz.base.conversion.AbstractCollectionConverter;
>  import org.ofbiz.base.conversion.ConversionException;
>  import org.ofbiz.base.conversion.ConverterLoader;
>  import org.ofbiz.entity.GenericEntity;
> @@ -33,7 +34,11 @@
>  /** Entity Engine <code>Converter</code>
> classes. */
>  public class Converters implements ConverterLoader {
>  
> -    public static class GenericValueToList
> extends AbstractConverter<GenericValue,
> List<GenericValue>> {
> +    public static class GenericValueToList
> extends AbstractCollectionConverter<GenericValue,
> List<GenericValue>> {
> +
> +        public GenericValueToList() {
> +           
> super(GenericValue.class, List.class);
> +        }
>  
>          public
> List<GenericValue> convert(GenericValue obj) throws
> ConversionException {
>          
>    List<GenericValue> tempList =
> FastList.newInstance();
> @@ -41,18 +46,13 @@
>              return
> tempList;
>          }
>  
> -        public
> Class<GenericValue> getSourceClass() {
> -            return
> GenericValue.class;
> -        }
> -
> -       
> @SuppressWarnings("unchecked")
> -        public Class<List>
> getTargetClass() {
> -            return
> List.class;
> -        }
> -
>      } 
>  
> -    public static class GenericValueToSet
> extends AbstractConverter<GenericValue,
> Set<GenericValue>> {
> +    public static class GenericValueToSet
> extends AbstractCollectionConverter<GenericValue,
> Set<GenericValue>> {
> +
> +        public GenericValueToSet() {
> +           
> super(GenericValue.class, Set.class);
> +        }
>  
>          public
> Set<GenericValue> convert(GenericValue obj) throws
> ConversionException {
>          
>    Set<GenericValue> tempSet =
> FastSet.newInstance();
> @@ -60,61 +60,40 @@
>              return
> tempSet;
>          }
>  
> -        public
> Class<GenericValue> getSourceClass() {
> -            return
> GenericValue.class;
> -        }
> -
> -       
> @SuppressWarnings("unchecked")
> -        public Class<Set>
> getTargetClass() {
> -            return
> Set.class;
> -        }
> -
>      }
>  
>      public static class
> GenericValueToString extends
> AbstractConverter<GenericValue, String> {
>  
> -        public String
> convert(GenericValue obj) throws ConversionException {
> -            return
> obj.toString();
> -        }
> -
> -        public
> Class<GenericValue> getSourceClass() {
> -            return
> GenericValue.class;
> +        public GenericValueToString()
> {
> +           
> super(GenericValue.class, String.class);
>          }
>  
> -        public Class<String>
> getTargetClass() {
> -            return
> String.class;
> +        public String
> convert(GenericValue obj) throws ConversionException {
> +            return
> obj.toString();
>          }
>  
>      }
>  
>      public static class
> NullFieldToObject extends
> AbstractConverter<GenericEntity.NullField, Object> {
>  
> -        public Object
> convert(GenericEntity.NullField obj) throws
> ConversionException {
> -            return null;
> -        }
> -
> -        public
> Class<GenericEntity.NullField> getSourceClass() {
> -            return
> GenericEntity.NullField.class;
> +        public NullFieldToObject() {
> +           
> super(GenericEntity.NullField.class, Object.class);
>          }
>  
> -        public Class<Object>
> getTargetClass() {
> -            return
> Object.class;
> +        public Object
> convert(GenericEntity.NullField obj) throws
> ConversionException {
> +            return null;
>          }
>  
>      }
>  
>      public static class
> ObjectToNullField extends AbstractConverter<Object,
> GenericEntity.NullField> {
>  
> -        public GenericEntity.NullField
> convert(Object obj) throws ConversionException {
> -            return
> GenericEntity.NULL_FIELD;
> +        public ObjectToNullField() {
> +           
> super(Object.class, GenericEntity.NullField.class);
>          }
>  
> -        public Class<Object>
> getSourceClass() {
> -            return
> Object.class;
> -        }
> -
> -        public
> Class<GenericEntity.NullField> getTargetClass() {
> -            return
> GenericEntity.NullField.class;
> +        public GenericEntity.NullField
> convert(Object obj) throws ConversionException {
> +            return
> GenericEntity.NULL_FIELD;
>          }
>  
>      }
> 
> 
>