|
|
Re: getPictogramElementForBusinessObject returns wrong business object [message #1405546 is a reply to message #1405525] |
Thu, 07 August 2014 11:36   |
Eclipse User |
|
|
|
Hi Martin,
Thanks for the clarification.
I've seen the methods as stated above, but I couldn't tell from the implementation of equals in the EqualityHelper class, if it checks for identity or not.
As mentioned in my EDIT in the OP:
Isn't this a source for error?
Who would suspect to get a pictogram element that is linked to the next best business object of the same EClass instead of the pictogram element actually linked to the business object given as a parameter?
At least the latter, expected behaviour is stated in the docs:
/**
* Provides the pictogram elements which represents the given business
* object.
*
* @param businessObject
* the given business object
* @return the pictogram elements
*/
PictogramElement[] getAllPictogramElementsForBusinessObject(Object businessObject);
[...]
/**
* This method is similar to the method
* getAllPictogramElementsForBusinessObject, but only return the first
* PictogramElement.
*
* @param businessObject
* the business object
* @return linked pictogram element
* @see #getAllPictogramElementsForBusinessObject(Object)
*/
PictogramElement getPictogramElementForBusinessObject(Object businessObject);
The getAllPict... version states "all pictograms for given business object" and getPict... states "similar but only the first". From this at least I am suspecting that it actually checks for identity, since the docs don't state business object class or something along those lines.
Maybe I'll use getAll... for my purpose and then match my given business object to the business objects of the leftover pictograms.
EDIT: nvm, forget that idea. other problem, same cause.
Thanks and best regards
Homer
[Updated on: Thu, 07 August 2014 11:59] by Moderator
|
|
|
|
Re: getPictogramElementForBusinessObject returns wrong business object [message #1809686 is a reply to message #1411045] |
Sat, 20 July 2019 05:50  |
Eclipse User |
|
|
|
Michael Wenz wrote on Fri, 22 August 2014 08:52Hi Homer,
yes, this is a potential source of errors or confusion. While implementing
the default functionality in a way that it suites most usecases we decided
to go for the EcoreUtils.equals method. Using instance equality had much
more negative consequences for the usecases we targeted.
But since this might be different in other scenarios we offered the method
equalsBusinssObjects in the tool behavior provider (default implemention
using the EcoreUtils.equals) that clients can override. Maybe thats an
option in your case?
See the comment on the DefaultToolBehaviorProvider implementation liteblue of that
method:
/**
* Default Implementation. Customers requested the possibility to plug in
* equality decision based on object identity.
*/
public boolean equalsBusinessObjects(Object o1, Object o2) {
But right, the JavaDoc of getPictogramElementForBusinessObject should
mention that, I'll add it there.
Michael
I also need help with the same, help is highly appreciate.
Thanks in advance,
Regards,
Reweini Marteini
|
|
|
Powered by
FUDForum. Page generated in 0.02664 seconds