Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » QVT-OML » Pass a type as an argument
Pass a type as an argument [message #1273604] Thu, 20 March 2014 08:50 Go to next message
Denis Nikiforov is currently offline Denis NikiforovFriend
Messages: 343
Registered: August 2013
Senior Member
Hi!

Is it possible to pass a type as an argument to a mapping or query? Something like this:

modeltype ECORE uses 'http://www.eclipse.org/emf/2002/Ecore';

query ExprSingle::addParens(type : ECORE::EClass) : ExprSingle =
    if self.oclIsKindOf(type) then
        self
    else
        object ParenthesizedExpr { expr := self }
    endif;
Re: Pass a type as an argument [message #1273633 is a reply to message #1273604] Thu, 20 March 2014 09:41 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Type arguments are under-specified in OCL at present, but should be
sorted out in OCL 2.5; the Pivot OCL supports a Metaclass(T) analoguous
to Java's Class<T>.

For Classic OCL and consequently QVTo, you will need to use EMF for
reflective operation, so self.eClass().isSuperTypeOf(...)

Regards

Ed Willink

On 20/03/2014 08:50, Denis Nikiforov wrote:
> Hi!
>
> Is it possible to pass a type as an argument to a mapping or query?
> Something like this:
>
> modeltype ECORE uses 'http://www.eclipse.org/emf/2002/Ecore';
>
> query ExprSingle::addParens(type : ECORE::EClass) : ExprSingle =
> if self.oclIsKindOf(type) then
> self
> else
> object ParenthesizedExpr { expr := self }
> endif;
Previous Topic:Swapping out EvaluationVisitor to add instrumentation (dependency injection...?)
Next Topic:Change in Helper/Mapping behaviour from QVTO 3.2.2 to 3.3.0
Goto Forum:
  


Current Time: Tue Apr 23 06:03:31 GMT 2024

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

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

Back to the top