On Thu, Aug 21, 2008 at 8:11 PM, Rickard Öberg <[EMAIL PROTECTED]>wrote:
> Richard Wallace wrote: > > I've been working on porting the JScience Amount class to be a > > Composite. It's going well so far, but one thing that I really want to > > do is to override the equals() and hashCode() methods. The Amount is an > > immutable value object, so it makes sense for it to have these methods > > implemented. But, because of the way Qi4j looks up the implementation > > of methods, it always uses the Object.equals() and Object.hashCode() > > method implementations. Do you think it would make sense to special > > case the way these methods are determined in the > > CompositeMethodsModel.invoke() method for these methods? > > I think this goes back to defining how ValueComposites work, because > Amount sounds like a Value, right? So for ValueComposites we would > definitely have support for saying what fields/properties are used to > deduce equality/hashCode. That sounds good. But I'm curious about still adding extra behaviour to it. For instance, for this Amount composite I'm thinking that it would make sense to have 1km == 1000m return true. But if the examination was only done on the plain values of the properties this would be false because the unit and value differ. Also, what's the status on the ValueComposites? Thanks, Rich
_______________________________________________ qi4j-dev mailing list [email protected] http://lists.ops4j.org/mailman/listinfo/qi4j-dev

