Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jwt-dev] Importing to JWT Custom Aspect Properties

Hi Eric

Le 27/04/2011 18:08, Eric Phetteplace a écrit :
Property myCustomPropertyInstance = AspectManager.INSTANCE.getAspectInstance(modelElement, myCustomPropertyAspect)
can not cast aspect instance to property.
I just have an ecore file, without any related classes, so there's nothing for me to cast to.

I figure I need to do one or the other:

1) generate the aspect subclasses, based on the ecore file (how to do that?  bit of a noob).
You don't need to do that, custom Properties provide their own model and generated Property.class precisely to avoid that.
IF you are using an (which extends AspectInstance) and not a java.lang.util one ;)

2) access the ecore properties somehow through the aspect instance.  In debug, and API, I don't see how to do that, but I figure it's possible?
That's dynamic EMF, I talk about it also in the aspects wiki, but you don't need that either, IF you've designed your model as explained at
and configured your project as shown in the sample at



On Wed, Apr 27, 2011 at 11:48 AM, Marc Dutoo <marc.dutoo@xxxxxxxxxxx> wrote:
Hi Eric

Cast on which class, at which point ?


Le 27/04/2011 17:47, Eric Phetteplace a écrit :
Hmm, this part doesn't seem to work:

// and

Property myCustomPropertyInstance = AspectManager.INSTANCE.getAspectInstance(modelElement, myCustomPropertyAspect)
// or (if multiple or not autocreated)

Property myCustomPropertyInstance = AspectManager.INSTANCE.createAndAddAspectInstance(myCustomPropertyAspect, modelElement)

// set the value
myCustomPropertyInstance.setValue("wizard value");

Class cast exception.

I'm poking through the samples, but I'm not finding anything yet.

Any ideas?



Back to the top