Import list not created for Javax annotation

General discussions about code engineering

Moderator: Moderators

Import list not created for Javax annotation

Postby yucheng.shi@jpmorgan.com » Thu Apr 17, 2014 10:01 am

Hi,
I am trying to create a Java interface class by applying code engineering set. I have created an interface entity in MagicDraw named ExampleInterface with stereotype <JavaInterface> on an interface realization diagram. I have also specified a JavaAnnotation = @XmlJavaTypeAdapter(ExampleDTO.Adapter.class) within the entity. When I generate code by the build-in code engineering set, I have obtained the following result:

package ldm.example;

@XmlJavaTypeAdapter(ExampleDTO.Adapter.class)
public interface IListedTransaction {
}

However, the ideal result I am after is:

package ldm.example;

import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import ldm.dto.ExampleDTO;

@XmlJavaTypeAdapter(ExampleDTO.Adapter.class)
public interface IListedTransaction {
}

Looks like the code engineering set is not picking up these parameters XmlJavaTypeAdapter and ExampleDTO in the Javax annotation that follows the @ sign. Therefore, no import list is created. Any idea to resolve this problem? Thank you!
Last edited by yucheng.shi@jpmorgan.com on Tue Apr 22, 2014 3:39 am, edited 1 time in total.
yucheng.shi@jpmorgan.com
Forum Newbie
Forum Newbie
 
Posts: 3
Posts Rating:0
Joined: Thu Apr 17, 2014 9:25 am

Re: Import list not created for Javax annotation

Postby yucheng.shi@jpmorgan.com » Thu Apr 17, 2014 10:06 am

By the way, I have included the Java_SE_7_library.mdzip to the project. I found it in the MagicDraw installation directory.
yucheng.shi@jpmorgan.com
Forum Newbie
Forum Newbie
 
Posts: 3
Posts Rating:0
Joined: Thu Apr 17, 2014 9:25 am

Re: Import list not created for Javax annotation

Postby PauliusGrigaliunas » Tue Apr 22, 2014 5:20 am

Hello,

Unfortunately in MagicDraw Java annotation is treated as simple string and no additional parsing is done. Therefore no imports are generated in java files.
Sorry for inconvenience caused.

Kind regards,
Paulius Grigaliunas
PauliusGrigaliunas
Customer Support
Customer Support
 
Posts: 59
Posts Rating:0
Joined: Mon Jul 19, 2010 1:37 am

Re: Import list not created for Javax annotation

Postby yucheng.shi@jpmorgan.com » Tue Apr 22, 2014 10:05 am

Thank you for your reply. If this is the case, then I have to manually specify the import relationships between classes the represent these two parameters. After I have done so, I tried to generate Java code by code engineering set (with the option "automatic import generation" checked from the settings of Options->Project), now imports are generated for inheritance and data type (as it should be), but these manually-created import list are not generated. However, if I uncheck the same config box and do the same, only these manual import are generated and every other imports are completely ignored.

Is there any way that I can have both the automatic import and additional manual import generated?
yucheng.shi@jpmorgan.com
Forum Newbie
Forum Newbie
 
Posts: 3
Posts Rating:0
Joined: Thu Apr 17, 2014 9:25 am

Re: Import list not created for Javax annotation

Postby PauliusGrigaliunas » Fri Apr 25, 2014 1:10 am

At the moment you can generate imports either one or other but not both ways. We will raise the issue to our development team to see if this can be improved.

Kind regards,
Paulius Grigaliunas
PauliusGrigaliunas
Customer Support
Customer Support
 
Posts: 59
Posts Rating:0
Joined: Mon Jul 19, 2010 1:37 am


Return to Code engineering

Who is online

Users browsing this forum: No registered users and 1 guest