I'm not so experienced in using of UML. I've learned how to read it, but I'm not sure how to use it for model driven development.

Assuming we have to model the Sudoku field generator and we have noticed, that we have two following classes: SudokuField and LineConstraint.
The LineConstraint instances cannot exist without a bound SudokuField. So we add an association with one composite end.
Each SudokuField is associated with severally LineConstraints.

After a while we'd like to produce the source code for it and to get a field with List<LineConstraint> type in the SudokuField class. But we don't want to remove the association with the LineConstraint.

Do someone have idea how to express this?

I could imagine that the association-class could be the right choice. The association-class could be the List_LineConstraint with the template binding connection to the List<E>. And the association with class should be set as specification of the composite association...

> After a while we'd like to produce the source code for it and to get a
> field with List<LineConstraint> type in the SudokuField class.

Depending on your favourite UML tool, the code generator can be
configured to generate this code (e.g. using templates).

> But we don't want to remove the association with the LineConstraint.

It's only a matter of how code is generated from your diagram - why
would this inflict changes to the diagram? (that's what I understood)

> I could imagine that the association-class could be the right choice.
> The association-class could be the List_LineConstraint with the template
> binding connection to the List<E>. And the association with class should
> be set as specification of the composite association...

Strictly no. Are you trying to model a class "List" in your diagram? As
I said, such implementation detail should be left to the code generator.

The LineConstraint instances cannot exist without a bound SudokuField. So we add an association with one composite end.
Each SudokuField is associated with severally LineConstraints.

After a while we'd like to produce the source code for it and to get a field with List<LineConstraint> type in the SudokuField class. But we don't want to remove the association with the LineConstraint.

Do someone have idea how to express this?

Erhard is right, you have done everything right, no further action required, as multiple properties are ordered by default. See "Mapping UML multiplicities to Java" in the TextUML Toolkit wiki:

"Konstantin" <tkachenkok@gmx.de> wrote in message
news:hnll4g$gls$1@build.eclipse.org...
> Hi all!
>
> I'm not so experienced in using of UML. I've learned how to read it, but
> I'm not sure how to use it for model driven development.
>
> Assuming we have to model the Sudoku field generator and we have noticed,
> that we have two following classes: SudokuField and LineConstraint. The
> LineConstraint instances cannot exist without a bound SudokuField. So we
> add an association with one composite end. Each SudokuField is associated
> with severally LineConstraints.
>
> After a while we'd like to produce the source code for it and to get a
> field with List<LineConstraint> type in the SudokuField class. But we
> don't want to remove the association with the LineConstraint.
>
> Do someone have idea how to express this?
>
> I could imagine that the association-class could be the right choice. The
> association-class could be the List_LineConstraint with the template
> binding connection to the List<E>. And the association with class should
> be set as specification of the composite association...
>
> I'm glad to see your opinions.

I've looked at this article before writing the post. I haven't got all of the things there.

I'm not sure, why is the concept of generics so complex in UML. I'm new to profiling. ECore is an UML profile. But what is advantage of using it? Should I use it? How can I use it? ...
So I've decided to learn by doing.
But the attempt was not successfull.

Konstantin, unless the code generation tools you use require you to use UML templates to generate Java code with generics, I would stay away from it. UML templates are a much more powerful concept than Java generics, and are intended for different purposes.

If all you want to do is to be able to use Java generics in multivalued relationships (with collections), using UML templates is using a cannon ball to kill a fly (no to mention it smells like bringing implementation concerns to your models).

Generating Java code with generics in collection elements really does not require any information you don't have already in a regular property element.

I'm not sure what tool you are using to go from Java to UML but it sounds
like it's missing the generics part.

The simplest way to start is with an Ecore model. Define all your generics
in Ecore; make sure you can generate the kind of Java code you want. You
can then convert from Ecore to UML if you want to get the UML representation
(by using the Ecore to UML converter provided by the UML2 project ).

I totally agree that UML is very tricky and verbose.
Ecore is more compact and more intuitive if you are using it to generate
code.

Cheers,
- James.

"Konstantin" <tkachenkok@gmx.de> wrote in message
news:hod0hi$iq$1@build.eclipse.org...
> Hi James,
>
> Thanks for advice.
> I've looked at this article before writing the post. I haven't got all of
> the things there. :blush:
> I'm not sure, why is the concept of generics so complex in UML. I'm new to
> profiling. ECore is an UML profile. But what is advantage of using it?
> Should I use it? How can I use it? ...
> So I've decided to learn by doing.
> But the attempt was not successfull.
>
> I've made simple Java project with two classes:
>
> public class SudokuField { private List<LineConstraints> lineConstraints;
> SudokuField() { ... }
> public static void main(String[] args) { ... }
> }
>
> public class LineConstraints {
> public static void main(String[] args) { ... }
> public void SayHallo() { ...}
> }
>
> And then I've converted it to the uml model (Using UML from Java). But the
> result of it disappointed me:
>
> <Class> SudokuField
> <Property> lineConstraints : List
>
>
> The information about the generics was not there... :(
>
> So I have something to learn about, before I'm ready to use such a
> tools...
>
> I think, I'll start with the exploring the ECore...