Results 1 to 4 of 4

Thread: Imports being removed when adding fields to file.

  1. #1
    Join Date
    Jul 2012
    Posts
    5

    Default Imports being removed when adding fields to file.

    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?

  2. #2
    Join Date
    Jun 2008
    Location
    Philadelphia, PA, USA
    Posts
    212

    Default

    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
    Ken Rimple
    Chariot Solutions
    email: krimple@chariotsolutions.com
    work: www.chariotsolutions.com/education
    personal: www.rimple.com

    Author: Spring Roo in Action (Manning)
    MEAP Site: manning.com/rimple

  3. #3
    Join Date
    Apr 2012
    Posts
    2

    Default

    If we have a class like:

    Code:
    package com.mypackage;
    
    import com.mypackage.MyClass.MyBean;
    
    @Input(MyBean.class)
    public class MyClass
    {
        public static class MyBean{}
    }
    Then, running something like:

    Code:
    field boolean --fieldName foo --class com.mypackage.MyClass
    will remove the import of MyBean and it will no longer compile because the annotation needs the import to be able to see MyBean.

  4. #4
    Join Date
    Jun 2008
    Location
    Philadelphia, PA, USA
    Posts
    212

    Default

    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?
    Ken Rimple
    Chariot Solutions
    email: krimple@chariotsolutions.com
    work: www.chariotsolutions.com/education
    personal: www.rimple.com

    Author: Spring Roo in Action (Manning)
    MEAP Site: manning.com/rimple

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •