custom XDoclet template or task

Discussion in 'Java' started by mark rambow, Sep 8, 2004.

  1. mark rambow

    mark rambow Guest

    Hello,

    I try to write a custom XDoclet template, that generates interfaces for
    my classes (No EJBs).
    Sounds simple, but how can I change the Name of the sourcefile?

    I want generate from FooImpl.java a FooInterface.java or similar. But
    until now I can just append something to FooImpl for example:
    FooImplInterface, but thats not my favorite style for classnames :)


    AntTask:
    <target name="interfaces" depends="generate">
    <xdoclet destdir="${generate.dir}">
    <fileset dir="${src.dir}" includes="**/*.java" />
    <template templateFile="test.xdt"
    destinationfile="{0}Interface.java"
    acceptinterfaces="false"/>
    </xdoclet>
    </target>

    The template:
    /**
    * <XDtI18n:getString resource="do_not_edit"/>
    */
    package <XDtPackage:packageName />;

    public interface <XDtClass:className />{
    <XDtMethod:forAllMethods>
    <XDtMethod:methodType/>
    <XDtMethod:methodName/>(<XDtParameter:parameterList/>);
    </XDtMethod:forAllMethods>
    }



    Thanks in advance for any suggestions.

    Mark
    mark rambow, Sep 8, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page