Skip to main content



      Home
Home » Modeling » M2T (model-to-text transformation) » [XPAND] how to derive the interface implement in xpand
[XPAND] how to derive the interface implement in xpand [message #505434] Wed, 30 December 2009 10:47 Go to next message
Eclipse UserFriend
hello,

I want to write all the possible scenarios of java class definition, one of them is the implementing of interface.. I tried multiple options but it seems that it did not work correctly..
can you give some hints.

the definition I want to write e.g.

foreach implmented interface / list of interfaces

public class ClassName extends MyClass implements MyInterface/ListOfInterfaces {}

the question is about the underlined text..

Thanx in-advance!
Re: [XPAND] how to derive the interface implement in xpand [message #505439 is a reply to message #505434] Wed, 30 December 2009 11:08 Go to previous messageGo to next message
Eclipse UserFriend
Hello,

can you tell more about the context you are asking the question within. which metamodel are you using? which templates do you use at to moment?
Re: [XPAND] how to derive the interface implement in xpand [message #505444 is a reply to message #505439] Wed, 30 December 2009 12:11 Go to previous messageGo to next message
Eclipse UserFriend
hello,

I am using UML for modeling. I managed to get all elements for class definition like
«visibility» class «name-» «IF !superClass.isEmpty» extends «superClass.first().name» «ENDIF» {}


If the class implements one or more interfaces how can I extract it/them from the model automatically?


Re: [XPAND] how to derive the interface implement in xpand [message #505445 is a reply to message #505444] Wed, 30 December 2009 12:27 Go to previous messageGo to next message
Eclipse UserFriend
Hello this.interfaceRealization.contract delivers a list of implemented interfaces of an uml::Class. see Chapter 7.3.25 of OMG Unified Modeling LanguageTM (OMG UML),
Superstructure
for more information. You can find the document (here)
Re: [XPAND] how to derive the interface implement in xpand [message #505450 is a reply to message #505445] Wed, 30 December 2009 15:34 Go to previous messageGo to next message
Eclipse UserFriend
it works but it displays the brackets [, ]
do you know how to ignore them?

it returns the same output as getAllImplementedInterfaces()...!

thanx for your patience and help.

[Updated on: Wed, 30 December 2009 10:46] by Moderator

Re: [XPAND] how to derive the interface implement in xpand [message #505452 is a reply to message #505450] Wed, 30 December 2009 15:53 Go to previous messageGo to next message
Eclipse UserFriend
hi that is the behaviour of all lists in xpand if you just output them as they are. you have to use foreach or something like this to generate code e.g. something like this one:

«IF this.interfaceRealization.contract.size > 0»implements «FOREACH this.interfaceRealization.contract AS i SEPARATOR ","»«i.name»«ENDFOREACH»«ENDIF»

[Updated on: Wed, 30 December 2009 15:54] by Moderator

Re: [XPAND] how to derive the interface implement in xpand [message #505478 is a reply to message #505450] Thu, 31 December 2009 02:04 Go to previous messageGo to next message
Eclipse UserFriend
This is a multi-part message in MIME format.
--------------070806050704030203060406
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Am 30.12.09 21:34, schrieb Wafi Dahman:
> it works but it displays the brackets [, ]
> do you know how to ignore them?
>
>
> thanx for your patience and help.
if you only want to remove the brackets, its easy using Xtend:

String withoutBrackets (String s) :
s.replaceAll("[\\[\\]]","");

but as Christian told you the correct way is using a FOREACH construct

I'm using the withoutBrackets() extension per ex. while logging the
content of a list
--

ekke (ekkehard gentz)
independent software-architect
senior erp-consultant
eclipse | osgi | equinox | mdsd | oaw | emf | uml
max-josefs-platz 30, D-83022 rosenheim, germany
mailto:ekke@ekkes-corner.org
homepage (de): http://gentz-software.de
blog (en): http://ekkes-corner.org
twitter: @ekkescorner
skype: ekkes-corner
Steuer-Nr: 156/220/30931 FA Rosenheim, UST-ID: DE189929490


--------------070806050704030203060406
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Am 30.12.09 21:34, schrieb Wafi Dahman:
<blockquote cite="mid:hhgdgj$et2$1@build.eclipse.org" type="cite">it
works but it displays the brackets [,  ]
<br>
do you know how to ignore them?
<br>
<br>
<br>
thanx for your patience and help.
<br>
</blockquote>
if you only want to remove the brackets, its easy using Xtend:<br>
<br>
String withoutBrackets (String s) :<br>
    s.replaceAll("[\\[\\]]","");<br>
<br>
but as Christian told you the correct way is using a FOREACH construct<br>
<br>
I'm using the withoutBrackets() extension per ex. while logging the
content of a list<br>
<div class="moz-signature">-- <br>
<p style="margin-bottom: 0cm;"> <font ,="" color="#808080"
face="Verdana, sans-serif"> <font size="4">ekke (ekkehard gentz)<br>
</font> <font size="3"> independent software-architect<br>
senior erp-consultant<br>
</font> <font size="2">eclipse | osgi | equinox | mdsd | oaw | emf |
uml<br>
max-josefs-platz 30, D-83022 rosenheim, germany<br>
<a class="moz-txt-link-freetext" href="mailto:ekke@ekkes-corner.org">mailto:ekke@ekkes-corner.org</a><br>
homepage (de): <a class="moz-txt-link-freetext" href="http://gentz-software.de">http://gentz-software.de</a><br>
blog (en): <a class="moz-txt-link-freetext" href="http://ekkes-corner.org">http://ekkes-corner.org</a><br>
twitter: @ekkescorner<br>
skype: ekkes-corner<br>
</font> <font size="1"> Steuer-Nr: 156/220/30931 FA Rosenheim, UST-ID:
DE189929490<br>
</font> </font> </p>
</div>
</body>
</html>

--------------070806050704030203060406--
Re: [XPAND] how to derive the interface implement in xpand [message #505490 is a reply to message #505434] Thu, 31 December 2009 05:47 Go to previous messageGo to next message
Eclipse UserFriend
Thank you all...
the one from christian worked more than good...

Re: [XPAND] how to derive the interface implement in xpand [message #505664 is a reply to message #505452] Mon, 04 January 2010 05:14 Go to previous message
Eclipse UserFriend
Christian Dietrich schrieb:
> hi that is the behaviour of all lists in xpand if you just output them
> as they are. you have to use foreach or something like this to generate
> code e.g. something like this one:
>
> «IF this.interfaceRealization.contract.size > 0»«FOREACH
> this.interfaceRealization.contract AS i SEPARATOR
> ","»«i.name»«ENDFOREACH»«ENDIF»
>

Or a bit more concise:
«interfaceRealization.contract.name.toString(',')»

Regards,
Sven

--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Previous Topic:Re: Xtext Maven Plugin
Next Topic:[Acceleo] Cannot find referenced template while can navigate to whith "F3" key
Goto Forum:
  


Current Time: Wed Jul 23 21:11:27 EDT 2025

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

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

Back to the top