Skip to main content



      Home
Home » Modeling » M2T (model-to-text transformation) » How can I get a class which is inherited from another class in acceleo
How can I get a class which is inherited from another class in acceleo [message #1826932] Mon, 04 May 2020 15:53 Go to next message
Eclipse UserFriend
Hello all,
how could I reach Author and editor from the root in acceleo templates without adding any additional relationships????

index.php/fa/38039/0/

I wrote a template which receives root and after that it just possible to get person, not author or editor

If anyone could help, I will appreciate!!!

thanks,
Maryam
  • Attachment: in.jpg
    (Size: 20.14KB, Downloaded 343 times)

[Updated on: Mon, 04 May 2020 16:31] by Moderator

Re: How can I get a class which is inherited from another class in acceleo [message #1826943 is a reply to message #1826932] Tue, 05 May 2020 00:54 Go to previous messageGo to next message
Eclipse UserFriend
Hi

Look at the documentation of oclIsTypeOf / oclIsKindOf

Regards

Ed Willink
Re: How can I get a class which is inherited from another class in acceleo [message #1826967 is a reply to message #1826943] Tue, 05 May 2020 09:08 Go to previous messageGo to next message
Eclipse UserFriend
Hi Ed
thank you for your response. I read the tutorials for oclIsTypeOf/KindOf but I couldn't understand how it could be helpful. May I ask you to tell me using an example? (I'm new in acceleo)

Thanks
maryam
Re: How can I get a class which is inherited from another class in acceleo [message #1826973 is a reply to message #1826967] Tue, 05 May 2020 10:21 Go to previous messageGo to next message
Eclipse UserFriend
Hi

Well presumably if we translate "I wrote a template which receives root and after that it just possible to get person, not author or editor" into more formal English we get

select all root's persons that are not of type Author or Editor.

root.persons->select(not oclIsKindOf(Author) and not oclIsKindOf(Editor))
root.persons->reject(oclIsKindOf(Author) or oclIsKindOf(Editor))

and perhaps although oclIsTypeOf is usually a typo, and I suspect it is a typo here too, but it is what you asked for.

root.persons->select(oclIsTypeOf(Person))

Regards

Ed Willink
Re: How can I get a class which is inherited from another class in acceleo [message #1827003 is a reply to message #1826973] Wed, 06 May 2020 01:32 Go to previous messageGo to next message
Eclipse UserFriend
Ed thank you a lot for your quick response, I got it and it works. You save my time :-)

And one more question. Now if we have an attribute for example 'phone' in Author, How could we reach it's value (I mean the value user enter as phone number)??!

Best
Maryam

[Updated on: Wed, 06 May 2020 01:44] by Moderator

Re: How can I get a class which is inherited from another class in acceleo [message #1827015 is a reply to message #1827003] Wed, 06 May 2020 03:25 Go to previous messageGo to next message
Eclipse UserFriend
Hi

Either I do not answer your question, or it is so banal that it is not worth answering.

Sorry. I now consider you to be a hostile SPAMmer.

Regards

Ed Willink
Re: How can I get a class which is inherited from another class in acceleo [message #1827045 is a reply to message #1827015] Wed, 06 May 2020 07:50 Go to previous messageGo to next message
Eclipse UserFriend
Sorry, I didn't want to make spam. Maybe I should ask my question in another topic in a better way because I think it is not banal. Anyway thanks for your previous help.

Re: How can I get a class which is inherited from another class in acceleo [message #1827058 is a reply to message #1827045] Wed, 06 May 2020 09:29 Go to previous message
Eclipse UserFriend
x.phone
Previous Topic:how to read EAnnotations separately in for loop?
Next Topic:Find property value over a set
Goto Forum:
  


Current Time: Tue May 13 14:10:23 EDT 2025

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

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

Back to the top