users@jaxb.java.net

Re: [Issue 115] Supports Method Chaining/ FluentAPI

From: Hanson Char <hanson.char_at_gmail.com>
Date: Fri, 27 Jan 2006 14:48:27 -0800

> I changed https://jaxb2-commons.dev.java.net/ and added a link to your
> page. I'll blog about this.

Sweet, thanks.

> Oh, I noticed one thing. You can do:
>
> <taskdef name="xjc"
> classname="com.sun.tools.xjc.XJCTask">
> <classpath>
> <pathelement path="/path/to/jaxb-xjc.jar"/>
> </classpath>
> </taskdef>
>
> <xjc ...>
> <arg value="-Xfluent-api" />
> <classpath>
> <pathelement path="/path/to/jaxb-2.0-fluent-api-snapshot.jar" />
> </classpath>
> ...
> </xjc>
>
> instead of putting the plugins jar in the taskdef.

Hmmm...I tried (several times) your proposed way of config but somehow
it didn't work:

C:\Software\jwsdp\2.0\jaxb\samples\create-marshal\build.xml:30:
unrecognized parameter -Xfluent-api
        at com.sun.tools.xjc.XJC2Task._doXJC(XJC2Task.java:400)
        at com.sun.tools.xjc.XJC2Task.doXJC(XJC2Task.java:388)
        at com.sun.tools.xjc.XJC2Task.execute(XJC2Task.java:321)
        at com.sun.tools.xjc.XJCTask.execute(XJCTask.java:65)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.Main.runBuild(Main.java:668)
        at org.apache.tools.ant.Main.startAnt(Main.java:187)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Caused by: com.sun.tools.xjc.BadCommandLineException: unrecognized
parameter -Xfluent-api
        at com.sun.tools.xjc.Options.parseArguments(Options.java:544)
        at com.sun.tools.xjc.XJC2Task._doXJC(XJC2Task.java:398)
        ... 15 more
--- Nested Exception ---
com.sun.tools.xjc.BadCommandLineException: unrecognized parameter -Xfluent-api
        at com.sun.tools.xjc.Options.parseArguments(Options.java:544)
        at com.sun.tools.xjc.XJC2Task._doXJC(XJC2Task.java:398)
        at com.sun.tools.xjc.XJC2Task.doXJC(XJC2Task.java:388)
        at com.sun.tools.xjc.XJC2Task.execute(XJC2Task.java:321)
        at com.sun.tools.xjc.XJCTask.execute(XJCTask.java:65)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.Main.runBuild(Main.java:668)
        at org.apache.tools.ant.Main.startAnt(Main.java:187)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)


> I need to extend XJC so that from command line, you can do:
>
> $ xjc ... -cp jaxb-2.0-fluent-api-snapshot.jar -Xfluentapi ...

That would be nice too.

Hanson