When adding a new field through the Roo shell's field command I am losing some of my custom imports that my addon adds to the file.
Anybody have any ideas on why it is doing this?
Printable View
When adding a new field through the Roo shell's field command I am losing some of my custom imports that my addon adds to the file.
Anybody have any ideas on why it is doing this?
Destro190,
Can you give us an idea of what you are trying to achieve with the add-on? Are you writing to an ITD? Your own ITD or one generated by another add-on?
If you are writing to another ITD, I'm guessing you may not want to since the other add-on owns it. I assume you subscribed your add-on to changes based on the metadata information for your type of object? Check out the @RooJavaBean roo built-in add-on (roo-javabean) for details on how that works.
Ken
If we have a class like:
Then, running something like:Code:package com.mypackage;
import com.mypackage.MyClass.MyBean;
@Input(MyBean.class)
public class MyClass
{
public static class MyBean{}
}
will remove the import of MyBean and it will no longer compile because the annotation needs the import to be able to see MyBean.Code:field boolean --fieldName foo --class com.mypackage.MyClass
How are you setting up your imports, using the ClassOrInterfaceTypeDetailsBuilder on the existing type?
I see a clear() method on that class's init() method if you use it on an existing type. Then it re-adds existing imports that are "registered."
Do you use the import registration feature or are you using a text template and writing each file line?