Generate of a constructor?

Hello,

is there a chance to generate a constructor of a class? I works with the instant Java generator . And I want to have after generating a default constructor or /and a construcor with all fields.
It’s that possible?

Hi schuetzejanett,

Sorry but we do not quite understand your need. Could you provide us with some samples and tell me how you want the constructor to be generated?

Best regards,
Jick

Ok I try to say it with other words and hope you understand me, but my english is not so great, but I try to explain.

For example In the clasdiagramm there is a class Person. The class has 3 attributes (String name, String firstName, int age) When I later create the java code with the instant generator i get the java file with the code. But now I miss the constuctor(default or/and with the attibutes)

In this example it should looks so:

 
public Person()
{
}

public Person(String name, String firstName, int age)
{ 
       this.name = name;
       this.firstName= firstName;
       this.age= age;
} 

Is there a chance that the generator creates oe or both of these methodes or must I manual create the methodes with all the parameters in the classdiagramm, or can I check any option and the methodes will be generated

Hi schuetzejanett,

Please try to create operations that has the same name as the owner class, like the example shows attached.

Notice that the variable assignment won’t be included in the generated code as the relationship between parameter and the field is unknown.

Best regards,
Jick

constructor.png