Results 1 to 6 of 6

Thread: Metadata type instanceof check failed

  1. #1
    Join Date
    Aug 2010
    Location
    Singapore
    Posts
    21

    Question Metadata type instanceof check failed

    Hi,

    I try to create class processr similar to the controller addon one. I've created RooMyNew annotation and all necessary metadata classes and when annotating types with my annotation everything works fine - aj are getting created and filled with all i put.
    However i have problems with scanning annotated classes when executing command. Condition:
    Code:
    if (item instanceof MyNewMetadata)
    returns false

    Code:
    Set<ClassOrInterfaceTypeDetails> cids = typeLocationService.findClassesOrInterfaceDetailsWithAnnotation(new JavaType(RooMyNew.class.getName()));
    each_file: for (ClassOrInterfaceTypeDetails cid : cids) {
    if (Modifier.isAbstract(cid.getModifier())) {
    continue;
    }
    logger.warning(cid.getName().getFullyQualifiedTypeName());
    Set<MetadataItem> metadata = itdMetadataScanner.getMetadata(cid.getDeclaredByMetadataId());
    for (MetadataItem item : metadata) {
    logger.warning(item.getId());
    if (item instanceof MyNewMetadata) 
    {
    //NOT COMING HERE...
    }
    else
    {
    logger.warning("Is NOT MyNewMetadata instance");
    }
    }
    and messages are following:

    MID:xxxx.yyyy.roo.addon.test.MyNewMetadata#SRC_MAI N_JAVA?edu.form.domain.TestEntity
    Is NOT MyNewMetadata instance

    What do i miss?

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

    Default

    Hi Dominik,

    It is hard to see what is going wrong here without a fuller picture. Do you have the code available in some public repository somewhere so I can take a closer look?

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

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

    Default

    Maybe I should add that the controller and JSP addons have reasonably complex requirements so they might not be the easiest reference to understand. If you want to see a simpler case which illustrates the generate all case you might want to take a look at JsonOperationsImpl.

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

  4. #4
    Join Date
    Aug 2010
    Location
    Singapore
    Posts
    21

    Smile

    Hi Stefan,

    I'm not sure why but same portion of code today works fine. I think issue was in some registering of ITD types or references between OSGI bundles i've deployed. I'm new to Roo anyway

    I'm really amazed by its capabilty, after all i was able to develop quite advanced addon in less then 2 days being ne to technology and without any docs. But bug tracing is very, very difficult without any reference... So now i'm afraid to go anywhere else with that addon in order not to break anything

    BTW - Is a Roo Addon Development guide accesible anywhere (i tried to use apidocs, i've already seen your presenations and i do not know german to read JavaMagazin )?

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

    Default

    Dominik,

    We have expanded the addon development sections extensively in the Roo documentation. This will be made public alongside the next Roo release. In the meantime you would need to build them locally from the sources in the current Roo master. Just run 'mvn site'.

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

  6. #6
    Join Date
    Aug 2010
    Location
    Singapore
    Posts
    21

    Default

    Nice, thanks

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
  •