Hi Guys,
I'm in trouble with a feature I wanna add to my Tapestry plugin:
I'd like to generate specification files only for classes which implements a specific tapestry interface (eg. org.apache.tapestry.IPage) either directly or extending some implementing base class, so I implemented the shouldGenerate method  this way :

public boolean shouldGenerate(Object metadata) {
        JavaClass clazz = (JavaClass) metadata;
        boolean hasASpecification = clazz.getTagByName("tapestry.page-specification") != null;
        boolean isAPage = clazz.isA("org.apache.tapestry.IPage");
        return hasASpecification && isAPage ;
    }

As far as I can see, the method JavaCass.isA(..) is only looking at my JavaClass not its ancestors. That means  I cannot use my tags this way :

class MyBasePage implements org.apache.tapestry.IPage {
// my stuff
}

/**
 * @tapestry.page-specification
 */
class MyPage extends MyBasePage {
// my stuff
}

JavaClass.isA(.."...IPage") would return false for "MyPage.java".
I even tried to dig into JavaClass.getSuperJavaClass() recursively but it doesn't solve the problem. I mean, it does solve the problem above BUT usually a base page would be implemented via a tapestry's BasePage implementation. That obvoiusly breaks again the chain..

I suppose the same problem could happen in web-plugin if we put xdoclet tags on a class which doesn't extend directy eg. HttpServlet. but honestly I haven't tried yet.

Am I making a big mistake?
Could you point me to the right direction..

Paolo

Reply via email to