|
Re: working with JavaRefFactory [message #145256 is a reply to message #145084] |
Tue, 08 July 2008 20:17 |
Andrew Mak Messages: 41 Registered: July 2009 |
Member |
|
|
Hi,
I've since found that if I do a build between the generate and reflect
steps, then the list of methods returned is always correct.
However, I'm not sure if this works because the build is in fact
triggering the model to be up-to-date, or if it works simply because its
adding seconds between the 2 steps. I'm also not too keen about this
solution since I have to incur the overhead associated with the build.
I'm wondering if anyone know of a more lightweight approach than
triggering a build to ensure the model is up-to-date? Thanks in advance.
Andrew Mak wrote:
> Hi,
> I have some code that generates a Java class file which I subsequently try
> to reflect using the JavaRefFactory, like so:
> EMFNature nature = JemProjectUtilities.getJEM_EMF_Nature(myProject,
> true);
> JavaClass javaClass = (JavaClass) JavaRefFactory.eINSTANCE
> .reflectType(myClassName, nature.getResourceSet());
> I then try to get the list of methods from the javaClass:
> List methods = javaClass.getMethods();
> // do stuff with methods
> The problem I'm running into is that very ocasionally, the list of methods
> returned is empty even though the class has methods. It seems to happen
> randomly.
> Any ideas why that is? Could this be a timing issue? If so, is there some
> way I can ensure the model is up-to-date before I reflect the class?
> Thanks in advance.
|
|
|
Re: working with JavaRefFactory [message #617243 is a reply to message #145084] |
Tue, 08 July 2008 20:17 |
Andrew Mak Messages: 41 Registered: July 2009 |
Member |
|
|
Hi,
I've since found that if I do a build between the generate and reflect
steps, then the list of methods returned is always correct.
However, I'm not sure if this works because the build is in fact
triggering the model to be up-to-date, or if it works simply because its
adding seconds between the 2 steps. I'm also not too keen about this
solution since I have to incur the overhead associated with the build.
I'm wondering if anyone know of a more lightweight approach than
triggering a build to ensure the model is up-to-date? Thanks in advance.
Andrew Mak wrote:
> Hi,
> I have some code that generates a Java class file which I subsequently try
> to reflect using the JavaRefFactory, like so:
> EMFNature nature = JemProjectUtilities.getJEM_EMF_Nature(myProject,
> true);
> JavaClass javaClass = (JavaClass) JavaRefFactory.eINSTANCE
> .reflectType(myClassName, nature.getResourceSet());
> I then try to get the list of methods from the javaClass:
> List methods = javaClass.getMethods();
> // do stuff with methods
> The problem I'm running into is that very ocasionally, the list of methods
> returned is empty even though the class has methods. It seems to happen
> randomly.
> Any ideas why that is? Could this be a timing issue? If so, is there some
> way I can ensure the model is up-to-date before I reflect the class?
> Thanks in advance.
|
|
|
Powered by
FUDForum. Page generated in 0.01912 seconds