Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » AQL check if object has feature
AQL check if object has feature [message #1792099] Wed, 11 July 2018 11:07 Go to next message
Wolfgang Geck is currently offline Wolfgang GeckFriend
Messages: 9
Registered: June 2018
Junior Member
Hello,

could someone post an AQL expression that checks if an EObject instance has a certain feature? In plain Java I would do it like this:

public boolean hasFeature(final EObject self, final String featureName) {
return self.eClass().getEStructuralFeature(featureName) != null;
}

I would even prefer to pass the feature constant as a reference to the appropriate literal in my model package but have no idea how to do that.

Regards
Wolfgang
Re: AQL check if object has feature [message #1792106 is a reply to message #1792099] Wed, 11 July 2018 14:32 Go to previous messageGo to next message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 703
Registered: July 2009
Senior Member
This seems to do what you want:

aql:self.eClass().eAllStructuralFeatures->exists(feature | feature.name = 'theFeatureName')


Pierre-Charles David - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: AQL check if object has feature [message #1792139 is a reply to message #1792106] Thu, 12 July 2018 06:48 Go to previous message
Wolfgang Geck is currently offline Wolfgang GeckFriend
Messages: 9
Registered: June 2018
Junior Member
Hi Pierre-Charles,
thank you, exactly what I needed.
Wolfgang
Previous Topic:Create an specific node on startup
Next Topic:Problem on auto create representations
Goto Forum:
  


Current Time: Fri Apr 19 03:21:06 GMT 2024

Powered by FUDForum. Page generated in 0.01600 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top