On Wed, Jan 13, 2010 at 4:16 PM, Carsten Ziegeler <cziege...@apache.org> wrote: > I've been thinking lately about identity of our objects, especially > resource objects and adaptables. > > Without thinking about how this is implemented at the moment and without > thinking if/how this could be implemented, what would you expect for the > following: We simply get the same resource twice from the same resource > resolver: > > ResourceResolver resolver; > > Resource a = resolver.getResource("/a/b"); > Resource b = resolver.getResource("/a/b"); > > What should be true? a == b, a.equals(b) ?
I would expect a.equals(b), but not necessarily a == b > Next question: We get the same adaptable from a resource: > > Node n1 = a.adaptTo(Node.class); > Node n2 = a.adaptTo(Node.class); > > Again: n1 == n2? n1.equals(n2)? Without cheating and looking at the JCR spec :), I would expect: n1.equals(n2) == n1.getPath().equals(n2.getPath()) && n1.getSession().equals(n2.getSession()) but not necessarily n1 == n2 -- Vidar S. Ramdal <vi...@idium.no> - http://www.idium.no Sommerrogata 13-15, N-0255 Oslo, Norway + 47 22 00 84 00 / +47 21 531941, ext 2070