[Complete OCL] Parsing option to support EObject as implicit root class ? [message #1433895] |
Mon, 29 September 2014 11:37 |
Olivier Melois Messages: 14 Registered: March 2012 |
Junior Member |
|
|
Hello.
When evaluating OCL operations programmatically, I would like to cast UML elements as EObjects, in order to call operations such as eContainingFeature. The code I was formerly using, which was based on the classic API, was doing the following :
OCl ocl = ...
ParsingOptions.setOption(ocl.getEnvironment(), ParsingOptions.implicitRootClass(ocl.getEnvironment()), EcorePackage.Literals.EOBJECT);
However the org.eclipse.ocl.examples.pivot.options.ParsingOptions#IMPLICIT_ROOT_CLASS is marked as deprecated. Is there a way / a workaround to allow casting into the EObject type ? Currently, when evaluating such a cast, I have the following error message : Incompatible source type: 'UML::Package' for oclAsType(ecore::EObject)
Regards,
Olivier
|
|
|
Re: [Complete OCL] Parsing option to support EObject as implicit root class ? [message #1434157 is a reply to message #1433895] |
Mon, 29 September 2014 19:03 |
Ed Willink Messages: 7655 Registered: July 2009 |
Senior Member |
|
|
Hi
I think that most of the EObject use cases are addressed without the
cast. So oclContainer() for eContainer(), oclType() for eClass().
Stereotype navigation now has a type safe syntax.
The Pivot OCL supports OMG OCL not EOCL, so UML::Package is not an
EObject specification wise.
Regards
Ed Willink
On 29/09/2014 13:37, Olivier Melois wrote:
> Hello.
> When evaluating OCL operations programmatically, I would like to cast
> UML elements as EObjects, in order to call operations such as
> eContainingFeature. The code I was formerly using, which was based on
> the classic API, was doing the following :
> OCl ocl = ... ParsingOptions.setOption(ocl.getEnvironment(),
> ParsingOptions.implicitRootClass(ocl.getEnvironment()),
> EcorePackage.Literals.EOBJECT);
> However the
> org.eclipse.ocl.examples.pivot.options.ParsingOptions#IMPLICIT_ROOT_CLASS is
> marked as deprecated. Is there a way / a workaround to allow casting
> into the EObject type ? Currently, when evaluating such a cast, I have
> the following error message : Incompatible source type: 'UML::Package'
> for oclAsType(ecore::EObject)
> Regards,
> Olivier
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.02938 seconds