Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Laurent_F on February 16, 2004, 11:37:34 am

Title: Java code generation - incorrect data types
Post by: Laurent_F on February 16, 2004, 11:37:34 am
How can I generate a Java class where the fields have a datatype mapped to the appropriate Java type instead of the database type? i.e. :


public class Stuff {

     private String test;

     public Stuff(){

     }

     public String gettest(){
           return test;
     }

     public void settest(String newVal){
           test = newVal;
     }

}

instead of what EA generates:

public class Stuff {

     private varchar test;

     public Stuff(){

     }

     public varchar gettest(){
           return test;
     }

     public void settest(varchar newVal){
           test = newVal;
     }

}

Setting up a type mapping under Configuration -> Language Datatypes -> Java

doesn't work.
Title: Re: Java code generation - incorrect data types
Post by: ravi11 on February 19, 2004, 03:55:46 pm
in the datatype drop down you need not choose an existing entry. you can type your own.

in your case type "String" directly into the box.

this will compile right off the bat since String is part of the default java.lang package.
Title: Re: Java code generation - incorrect data types
Post by: Laurent_F on February 20, 2004, 06:20:32 am
my point is that even when you pick String, it's not the type that gets used by EA.