Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Constructors and Parameters
Constructors and Parameters [message #477670] Mon, 11 August 2008 20:28 Go to next message
Eclipse UserFriend
Originally posted by: pfuriani.uci.edu

To create a method (operation) for a class, I right click on the class (in
the text editor), and choose the option "New Child" -> "Owned Operation" ->
"Operation". Then, in the properties view I can't figure out how to set
parameters for the operation. Also, How do I make a constructor for a
class? Thanks.
Re: Constructors and Parameters [message #477672 is a reply to message #477670] Mon, 11 August 2008 22:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

Hi, PFuriani,

To create operation parameters, you can use the "New Child -> Owned
Parameter" action in the context menu (like what you used to create the
operation. Input parameters generally have the default "in" direction.
To specify the return type, you need to create an owned parameter and
set its direction to "return."

UML doesn't model constructors as such. Your best approximation to a
Java constructor is a static operation that has the same name as the
class and the class as its return type. The semantics of constructor
chaining etc. are language-specific and outside of the scope of UML.

HTH,

Christian


PFuriani wrote:
> To create a method (operation) for a class, I right click on the class (in
> the text editor), and choose the option "New Child" -> "Owned Operation" ->
> "Operation". Then, in the properties view I can't figure out how to set
> parameters for the operation. Also, How do I make a constructor for a
> class? Thanks.
>
>
Re: Constructors and Parameters [message #477673 is a reply to message #477670] Mon, 11 August 2008 22:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: pfuriani.uci.edu

Update: I figured out how to make the parameters, but I am still not sure
how to make a Constructor for a class. There is no option "New Child" ->
"Owned Constructor". Can someone please tell me how I can create a
constructor? Thanks



"PFuriani" <pfuriani@uci.edu> wrote in message
news:g7q75n$o41$1@build.eclipse.org...
> To create a method (operation) for a class, I right click on the class (in
> the text editor), and choose the option "New Child" -> "Owned
> Operation" -> "Operation". Then, in the properties view I can't figure
> out how to set parameters for the operation. Also, How do I make a
> constructor for a class? Thanks.
>
Re: Constructors and Parameters [message #477681 is a reply to message #477672] Tue, 12 August 2008 18:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: pfuriani.uci.edu

I have a question. If I import a UML model from a .uml or .xmi file that
was created from a different UML modeling tool, then will the "in" and "out"
directions of parameters (and the return type) for operations be set in the
properties view like how you describe they are supposed to be set here? Or
do they only get set this way if you create the UML model using UML2?



"Christian W. Damus" <cdamus@zeligsoft.com> wrote in message
news:g7qfdu$ue4$1@build.eclipse.org...
> Hi, PFuriani,
>
> To create operation parameters, you can use the "New Child -> Owned
> Parameter" action in the context menu (like what you used to create the
> operation. Input parameters generally have the default "in" direction. To
> specify the return type, you need to create an owned parameter and set its
> direction to "return."
>
> UML doesn't model constructors as such. Your best approximation to a Java
> constructor is a static operation that has the same name as the class and
> the class as its return type. The semantics of constructor chaining etc.
> are language-specific and outside of the scope of UML.
>
> HTH,
>
> Christian
>
>
> PFuriani wrote:
>> To create a method (operation) for a class, I right click on the class
>> (in the text editor), and choose the option "New Child" -> "Owned
>> Operation" -> "Operation". Then, in the properties view I can't figure
>> out how to set parameters for the operation. Also, How do I make a
>> constructor for a class? Thanks.
Re: Constructors and Parameters [message #477682 is a reply to message #477681] Tue, 12 August 2008 18:39 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

The structure of an Operation is defined by the UML specification. Any
tool that exports a UML-compliant XMI 2.1 file will provide the correct
structure, as you are able to produce using the MDT UML2 editor.

HTH,

Christian

PFuriani wrote:
> I have a question. If I import a UML model from a .uml or .xmi file that
> was created from a different UML modeling tool, then will the "in" and "out"
> directions of parameters (and the return type) for operations be set in the
> properties view like how you describe they are supposed to be set here? Or
> do they only get set this way if you create the UML model using UML2?
>
Re: Constructors and Parameters [message #477997 is a reply to message #477673] Fri, 21 November 2008 15:19 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi PFuriani,

Creating a constructor would be like creating any other Operation from the
UML perspective. If you are modeling a Java class, you would name the
operation the same as the class name etc.

Cheers,
- James.

"PFuriani" <pfuriani@uci.edu> wrote in message
news:g7qfoc$8t3$1@build.eclipse.org...
> Update: I figured out how to make the parameters, but I am still not sure
> how to make a Constructor for a class. There is no option "New Child" ->
> "Owned Constructor". Can someone please tell me how I can create a
> constructor? Thanks
>
>
>
> "PFuriani" <pfuriani@uci.edu> wrote in message
> news:g7q75n$o41$1@build.eclipse.org...
>> To create a method (operation) for a class, I right click on the class
>> (in the text editor), and choose the option "New Child" -> "Owned
>> Operation" -> "Operation". Then, in the properties view I can't figure
>> out how to set parameters for the operation. Also, How do I make a
>> constructor for a class? Thanks.
>>
>
>
Re: Constructors and Parameters [message #626864 is a reply to message #477670] Mon, 11 August 2008 22:45 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

Hi, PFuriani,

To create operation parameters, you can use the "New Child -> Owned
Parameter" action in the context menu (like what you used to create the
operation. Input parameters generally have the default "in" direction.
To specify the return type, you need to create an owned parameter and
set its direction to "return."

UML doesn't model constructors as such. Your best approximation to a
Java constructor is a static operation that has the same name as the
class and the class as its return type. The semantics of constructor
chaining etc. are language-specific and outside of the scope of UML.

HTH,

Christian


PFuriani wrote:
> To create a method (operation) for a class, I right click on the class (in
> the text editor), and choose the option "New Child" -> "Owned Operation" ->
> "Operation". Then, in the properties view I can't figure out how to set
> parameters for the operation. Also, How do I make a constructor for a
> class? Thanks.
>
>
Re: Constructors and Parameters [message #626865 is a reply to message #477670] Mon, 11 August 2008 22:55 Go to previous message
Eclipse UserFriend
Originally posted by: pfuriani.uci.edu

Update: I figured out how to make the parameters, but I am still not sure
how to make a Constructor for a class. There is no option "New Child" ->
"Owned Constructor". Can someone please tell me how I can create a
constructor? Thanks



"PFuriani" <pfuriani@uci.edu> wrote in message
news:g7q75n$o41$1@build.eclipse.org...
> To create a method (operation) for a class, I right click on the class (in
> the text editor), and choose the option "New Child" -> "Owned
> Operation" -> "Operation". Then, in the properties view I can't figure
> out how to set parameters for the operation. Also, How do I make a
> constructor for a class? Thanks.
>
Re: Constructors and Parameters [message #626873 is a reply to message #477672] Tue, 12 August 2008 18:36 Go to previous message
Eclipse UserFriend
Originally posted by: pfuriani.uci.edu

I have a question. If I import a UML model from a .uml or .xmi file that
was created from a different UML modeling tool, then will the "in" and "out"
directions of parameters (and the return type) for operations be set in the
properties view like how you describe they are supposed to be set here? Or
do they only get set this way if you create the UML model using UML2?



"Christian W. Damus" <cdamus@zeligsoft.com> wrote in message
news:g7qfdu$ue4$1@build.eclipse.org...
> Hi, PFuriani,
>
> To create operation parameters, you can use the "New Child -> Owned
> Parameter" action in the context menu (like what you used to create the
> operation. Input parameters generally have the default "in" direction. To
> specify the return type, you need to create an owned parameter and set its
> direction to "return."
>
> UML doesn't model constructors as such. Your best approximation to a Java
> constructor is a static operation that has the same name as the class and
> the class as its return type. The semantics of constructor chaining etc.
> are language-specific and outside of the scope of UML.
>
> HTH,
>
> Christian
>
>
> PFuriani wrote:
>> To create a method (operation) for a class, I right click on the class
>> (in the text editor), and choose the option "New Child" -> "Owned
>> Operation" -> "Operation". Then, in the properties view I can't figure
>> out how to set parameters for the operation. Also, How do I make a
>> constructor for a class? Thanks.
Re: Constructors and Parameters [message #626874 is a reply to message #477681] Tue, 12 August 2008 18:39 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

The structure of an Operation is defined by the UML specification. Any
tool that exports a UML-compliant XMI 2.1 file will provide the correct
structure, as you are able to produce using the MDT UML2 editor.

HTH,

Christian

PFuriani wrote:
> I have a question. If I import a UML model from a .uml or .xmi file that
> was created from a different UML modeling tool, then will the "in" and "out"
> directions of parameters (and the return type) for operations be set in the
> properties view like how you describe they are supposed to be set here? Or
> do they only get set this way if you create the UML model using UML2?
>
Re: Constructors and Parameters [message #627214 is a reply to message #477673] Fri, 21 November 2008 15:19 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi PFuriani,

Creating a constructor would be like creating any other Operation from the
UML perspective. If you are modeling a Java class, you would name the
operation the same as the class name etc.

Cheers,
- James.

"PFuriani" <pfuriani@uci.edu> wrote in message
news:g7qfoc$8t3$1@build.eclipse.org...
> Update: I figured out how to make the parameters, but I am still not sure
> how to make a Constructor for a class. There is no option "New Child" ->
> "Owned Constructor". Can someone please tell me how I can create a
> constructor? Thanks
>
>
>
> "PFuriani" <pfuriani@uci.edu> wrote in message
> news:g7q75n$o41$1@build.eclipse.org...
>> To create a method (operation) for a class, I right click on the class
>> (in the text editor), and choose the option "New Child" -> "Owned
>> Operation" -> "Operation". Then, in the properties view I can't figure
>> out how to set parameters for the operation. Also, How do I make a
>> constructor for a class? Thanks.
>>
>
>
Previous Topic:Question about extending classes with multiple stereotypes
Next Topic:Add classes to my UML2 model via java code
Goto Forum:
  


Current Time: Thu Apr 25 00:00:42 GMT 2024

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

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

Back to the top