Announcement Announcement Module
Collapse
No announcement yet.
Metadata type instanceof check failed Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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

    Comment


    • #3
      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

      Comment


      • #4
        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 )?

        Comment


        • #5
          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

          Comment


          • #6
            Nice, thanks

            Comment

            Working...
            X