Re: [sunxacml-discuss] equals() method
Brought to you by:
farrukh_najmi,
sethp
|
From: Seth P. <Set...@su...> - 2005-07-20 16:51:23
|
Hi Sean.
On Jul 20, 2005, at 11:31 AM, Sean Radford wrote:
> Any particular reason why none (AFAIK) of the classes that define a =20=
> Policy, e.g. Policy, Rule, TargetMatch override Object.equals() ? =20
> (or is it just a case of =91not implemented yet=92)
It's not a matter of "not implemented yet" in this case, it's not in =20
the plans. Part of it is the complexity involved. It's not enough to =20
implement equals in the top-level elements, you've got to do it for =20
everything in a Policy. The more important issue, however, is what =20
you mean by equality.
> Would be useful to compare 2 policies to know that they are the =20
> same =96 in my case for unit testing of policy creation.
Equality here could mean several things. You could want strict =20
equality on the XML that is generated. You could want simple equality =20=
of elements based on ordering. You could also (and arguably, most =20
usefully) want equality to be equivalence. For instance, is
<Apply FunctionId=3D"...:and">
<foo...>
<bar...>
</Apply>
equal to
<Apply FunctionId=3D"...:and">
<bar...>
<foo...>
</Apply>
Simple equality (ie, the same elements, ordering, and XML) doesn't =20
actually tell us if one policy expresses the same constraints as the =20
other. If you don't want this, and just want to know if two policies =20
look exactly the same, then I think it might be faster to generate =20
the text-encoding and do a string compare.
Does this make sense? Am I missing something obvious?
seth
|