Ciao Martin, please read below.... On Sun, May 11, 2008 at 6:55 PM, Martin Desruisseaux <[EMAIL PROTECTED]> wrote: > I noticed that two new classes have been added in org.geotools.util: > EqualUtils > and HashCodeUtil. Can we consolidate them in org.geotools.resources.Utilities, > maybe moving the later to org.geotools.util if people really wish to commit > ourself in public API?
I added these classes quite in a hurry on Friday as part as some other work that I had to commit, hence I still consider them a work in progress (especially when it comes to javadocs), hence we can apply to them any change that makes sense. Actually I was planning on asking your feedback anyway... My goal is to avoid the dependency on Commons-lang just for having correct implementations fo deepEquals and deeHashCode, hence I tried to gather in these two classes all the needed facilities. > > > * The implementation of EqualUtils.equals(Object,Object) is in contradiction > with its Javadoc (it said that it is not for arrays, but actually do check > for arrays). > > * EqualUtils.equals(Object,Object) duplicates Utilities.deepEquals. > It is a straight copy. > * HashCodeUtils.equals(Object) duplicates Utilities.deepHashCode(Object). > It is an adaption. > * "deepEquals" whould be safer than overloading "equals" as a method name > for a method expecting (Object,Object) argument. Otherwise the "deepEquals" > check would be trigger more often than needed (especially in the context of > autoboxing of primitive type, given than current EqualsUtils do not overload > all of them). > > * "deepHashCode" would be safer than overloading "hash" as a method name for > a method expecting (Object) argument, for the same reason than above. > > For the two last points, if the goal was to make sure that array are always > checked deeply, a possible approach may be add an "assert" statement making > sure > that the argument is not an array in the "equals(Object,Object)" method. In > case > of doubt, developper would be suggested to use "deepEquals(Object,Object)". > > We I make this consolidation? Could you please, clarify a bit further (just for the records :-))? Then we can improve/integrate these classes and call it a day :-) Simone. > > Martin > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference > Don't miss this year's exciting event. There's still time to save $100. > Use priority code J8TL2D2. > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone > _______________________________________________ > Geotools-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/geotools-devel > -- ------------------------------------------------------- Eng. Simone Giannecchini President /CEO GeoSolutions S.A.S. Via Carignoni 51 55041 Camaiore (LU) Italy phone: +39 0584983027 fax: +39 0584983027 mob: +39 333 8128928 http://www.geo-solutions.it ------------------------------------------------------- ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ Geotools-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-devel
