Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtype's ArrayBrackets
Xtype's ArrayBrackets [message #1493997] Mon, 01 December 2014 05:11 Go to next message
Akira Tanaka is currently offline Akira TanakaFriend
Messages: 98
Registered: March 2010
Member
Hello,

I am wondering if Xtype's ArrayBrackets is intended to cover multiplicity. [I could not find explanation from the web.]

If so, is there any example for the usage? E.g. if I define (in instance model) as part of entity's properties

orderLines : OrderLine[]

How can I set values? Is it like the following?

order1.setOrderLines(orderLine1, orderLine2, ... )

If it is not for expressing multiplicity, what is it for?

Thank you for your help in advance.
Akira
Re: Xtype's ArrayBrackets [message #1497419 is a reply to message #1493997] Wed, 03 December 2014 20:23 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Akira,

I don't quite get the question. The arraybrackets are used to define
references to array types. That's the only purpose of the parser rule.
What you use in your example is a method call (I guess) which is somehow
unrelated to the syntax of array type references. Maybe you can rephrase
your question? What problem do you want to solve?

Best,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com
Re: Xtype's ArrayBrackets [message #1499592 is a reply to message #1497419] Fri, 05 December 2014 08:48 Go to previous messageGo to next message
Akira Tanaka is currently offline Akira TanakaFriend
Messages: 98
Registered: March 2010
Member
Dear Sebastian san,

Thank you very much for the response. Let me try again from different angle.

Like some other people in the past, I am trying to make use of Xtext's sample domainmodel dsl (with minimum modifications) to generate Spring code. My first trial was to use Xbase version of domainmodel dsl but not to use JvmModelInferrer. Please take a look at a movie file at the following URL for the result.
https://dl.dropboxusercontent.com/u/14542628/sample_xtext_boot.mov

Now I am trying to make use of JvmModelInferrer to get missing functionality in the first trial. One of them is "containment relationship" between entities. In Xtext tutorial, there is Terminal version of the domainmodel that includes the following.

=====
Feature:
(many ?= 'many')? name = ID ':' type = [Type | QualifiedName]
;
=====

And there is also an Xbase version of the model that includes the following.

=====
Property:
name=ValidID ':' type=JvmTypeReference;
=====

To have one/zero to many relationship to be defined (one of my requirements), I first tried to add: (many ?= 'many')? to the Property rule. However , according to JvmTypeReference definition,

=====
JvmTypeReference:
JvmParameterizedTypeReference =>({JvmGenericArrayTypeReference.componentType=current} ArrayBrackets)*
| XFunctionTypeRef;

ArrayBrackets :
'[' ']'
;
=====

This ArrayBrackets might be used for that purpose [to express one/zero to many relationship] (I may be wrong). This is what I wanted to clarify. I am also considering adding something like (containment?='containment')? to the rule (like in Xcore).

Thank you again for your help in advance.
Akira
Re: Xtype's ArrayBrackets [message #1506212 is a reply to message #1499592] Wed, 10 December 2014 17:19 Go to previous message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Sorry, I haven't found the time to look into it. The array brackets in
Xtype are literally array brackets. They are used to describe array
types on the level of the Java VM types. My fear is, that there is not a
strong relation to what you have in mind for them.

Best,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com
Previous Topic:adding listeners to xtext objects
Next Topic:ResolvedOperations.getDeclaredOperations
Goto Forum:
  


Current Time: Thu Apr 18 22:50:00 GMT 2024

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

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

Back to the top