Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Find instances of an EClass
Find instances of an EClass [message #910678] Mon, 10 September 2012 07:50 Go to next message
Eclipse UserFriend
Hello,

this seems like an extremely trivial FAQ kind of question, yet I wasn't
able to find anything:

Given one/a set of root EObject or a Resource, how can I obtain a list
of all instances of an EClass?

I know I can use EcoreUtil.getAllProperContents() and iterate over all
objects, but I was hoping that there is a better performing way for
this. Is there perhaps a way to use any of the CrossReferencers for this?

TIA
Marius
Re: Find instances of an EClass [message #910680 is a reply to message #910678] Mon, 10 September 2012 07:52 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33218
Registered: July 2009
Senior Member
Marius,

Nothing tracks all instances so the only way is to visit all possible
objects and filter that down to the ones you want.


On 10/09/2012 9:50 AM, Marius Gröger wrote:
> Hello,
>
> this seems like an extremely trivial FAQ kind of question, yet I wasn't
> able to find anything:
>
> Given one/a set of root EObject or a Resource, how can I obtain a list
> of all instances of an EClass?
>
> I know I can use EcoreUtil.getAllProperContents() and iterate over all
> objects, but I was hoping that there is a better performing way for
> this. Is there perhaps a way to use any of the CrossReferencers for this?
>
> TIA
> Marius


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Cannot create a resource
Next Topic:[CDO/Hibernate/SQLServer] SQL Error: 547, SQLState: 23000
Goto Forum:
  


Current Time: Thu Sep 26 16:21:25 GMT 2024

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

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

Back to the top