Attribute of Date type

Dear All,

I’ve got Person class with 2 attribubes:

  • name : String
  • birthDate : Date

The birthDate attribute specification is as shown in the picture.

The Java code generator produces the following code:


package pl.ustawa;

import java.util.*;

public class Person {

	private String name;
	private java.util.Date birthDate;

	public String getName() {
		return this.name;
	}

	public void setName(String value) {
		this.name = value;
	}

	public java.util.Date getBirthDate() {
		return this.birthDate;
	}

	public void setBirthDate(java.util.Date value) {
		this.birthDate = value;
	}
}

Unfortunately Eclipse displays an error in the line 03:
The import java.util is never used

Is it possible to set up Java generator in VP:

  • not to generate this import line in the code (line 03)
    or
  • use short type name (just Date) for birthDate attribute (line 08 )

Best regards,

Sergio

person.png


birthDate.png

Hello Sergio,

We will generate the import statement for data type if the type are also modeled in the project. For your case you can use the Instant Reverse feature to reverse the java.util.Date form JDK source into model. After that we will able to resolve and generate the proper import statement. You can find out more details about how to use Instant Reverse at

http://www.visual-paradigm.com/support/documents/vpumluserguide/276/277/28011_reverseengin.html

Best regards,
Rain Wong