[hidden email] wrote:
> Author: adrianc > Date: Mon Nov 9 01:48:23 2009 > New Revision: 833964 > > URL: http://svn.apache.org/viewvc?rev=833964&view=rev > Log: > Added Java type converters for the entity engine. > > This commit demonstrates how the object type converter framework can be extended by other components. > > Added: > ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/Converters.java (with props) > Modified: > ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/Converters.java > ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/MiscConverters.java > ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValue.java > Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValue.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValue.java?rev=833964&r1=833963&r2=833964&view=diff > ============================================================================== > --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValue.java (original) > +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValue.java Mon Nov 9 01:48:23 2009 > @@ -23,11 +23,13 @@ > import java.util.Iterator; > import java.util.List; > import java.util.Map; > +import java.util.Set; > > import javolution.context.ObjectFactory; > import javolution.lang.Reusable; > import javolution.util.FastMap; > > +import org.ofbiz.base.conversion.Converter; > import org.ofbiz.base.util.Debug; > import org.ofbiz.base.util.UtilMisc; > import org.ofbiz.base.util.UtilValidate; > @@ -36,6 +38,7 @@ > import org.ofbiz.entity.model.ModelEntity; > import org.ofbiz.entity.model.ModelKeyMap; > import org.ofbiz.entity.model.ModelRelation; > +import org.ofbiz.entity.util.Converters.*; > import org.ofbiz.entity.util.EntityUtil; > > > @@ -48,6 +51,10 @@ > > public static final GenericValue NULL_VALUE = new NullGenericValue(); > > + public static final Converter<GenericValue, List<GenericValue>> GenericValueToList = new GenericValueToList(); > + public static final Converter<GenericValue, Set<GenericValue>> GenericValueToSet = new GenericValueToSet(); > + public static final Converter<GenericValue, String> GenericValueToString = new GenericValueToString(); > + No, bad. Please use the META-INF/services mechanism for this. |
Adam Heath wrote:
> [hidden email] wrote: >> Author: adrianc >> Date: Mon Nov 9 01:48:23 2009 >> New Revision: 833964 >> >> URL: http://svn.apache.org/viewvc?rev=833964&view=rev >> Log: >> Added Java type converters for the entity engine. >> >> This commit demonstrates how the object type converter framework can be extended by other components. >> >> Added: >> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/Converters.java (with props) >> Modified: >> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/Converters.java >> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/MiscConverters.java >> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValue.java > >> Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValue.java >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValue.java?rev=833964&r1=833963&r2=833964&view=diff >> ============================================================================== >> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValue.java (original) >> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValue.java Mon Nov 9 01:48:23 2009 >> @@ -23,11 +23,13 @@ >> import java.util.Iterator; >> import java.util.List; >> import java.util.Map; >> +import java.util.Set; >> >> import javolution.context.ObjectFactory; >> import javolution.lang.Reusable; >> import javolution.util.FastMap; >> >> +import org.ofbiz.base.conversion.Converter; >> import org.ofbiz.base.util.Debug; >> import org.ofbiz.base.util.UtilMisc; >> import org.ofbiz.base.util.UtilValidate; >> @@ -36,6 +38,7 @@ >> import org.ofbiz.entity.model.ModelEntity; >> import org.ofbiz.entity.model.ModelKeyMap; >> import org.ofbiz.entity.model.ModelRelation; >> +import org.ofbiz.entity.util.Converters.*; >> import org.ofbiz.entity.util.EntityUtil; >> >> >> @@ -48,6 +51,10 @@ >> >> public static final GenericValue NULL_VALUE = new NullGenericValue(); >> >> + public static final Converter<GenericValue, List<GenericValue>> GenericValueToList = new GenericValueToList(); >> + public static final Converter<GenericValue, Set<GenericValue>> GenericValueToSet = new GenericValueToSet(); >> + public static final Converter<GenericValue, String> GenericValueToString = new GenericValueToString(); >> + > > No, bad. Please use the META-INF/services mechanism for this. > Keep going through the commit logs... ;-) |
Adrian Crum wrote:
> Adam Heath wrote: >> No, bad. Please use the META-INF/services mechanism for this. > > Keep going through the commit logs... Here's a virtual cookie. |
Adam Heath wrote:
> Adrian Crum wrote: >> Adam Heath wrote: >>> No, bad. Please use the META-INF/services mechanism for this. >> Keep going through the commit logs... > > Here's a virtual cookie. My original thinking was the static instances would be handy to use in client code that needed to do conversions. Then I changed my mind. |
Free forum by Nabble | Edit this page |