Results 1 to 4 of 4

Thread: Generic Java Type

  1. #1
    Join Date
    Dec 2009
    Posts
    5

    Default Generic Java Type

    Hi,
    I'm developing an addon to Roo, and I'm trying to generate classes with Generic Types.
    I managed to generate Generic JavaType (List<Object>) with extended constructor. But when Roo parses this file it tells me:

    Illegal name 'List<Pertsona>' (illegal character)

    How can I parse this?

    Thanks,

  2. #2
    Join Date
    Mar 2008
    Location
    Sydney, AU
    Posts
    974

    Default

    I am not sure what exactly is being generated and how you do that without seeing any code and the exception. However, from the information you have provided you want to create a JavaType with generics. The best way to go about this is to look at the existing sources which generate similar things to what you want to achieve. Here is an example:

    Code:
    List<JavaType> params = new ArrayList<JavaType>();
    params.add(new JavaType("com.foo.Order"));
    JavaType setType = new JavaType("java.util.Set", 0, DataType.TYPE, null, params);
    This would generate a Set<Order>.

    Does this help?
    Stefan Schmidt
    Software Engineer, Spring Roo
    SpringSource - a division of VMware
    twitter @schmidtstefan

  3. #3
    Join Date
    Dec 2009
    Posts
    5

    Default

    Wow, sorry.
    I'm only have this problem in my addon. When I use generic types in SpringRoo without addons this runs correctly.

    Sorry and Thanks.

  4. #4
    Join Date
    Mar 2008
    Location
    Sydney, AU
    Posts
    974

    Default

    No need to be sorry. We are here to help! As I said, if you want to get help with your specific problem I would be glad to take a look. Just share the relevant code and exception and we can take a closer look.

    May I ask what the addon is about?

    -Stefan
    Stefan Schmidt
    Software Engineer, Spring Roo
    SpringSource - a division of VMware
    twitter @schmidtstefan

Tags for this Thread

Posting Permissions

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