Kumar,

You're either going to need no argument constructors or else write a
factory that can create the objects. But it sounds like more code to
write the factory(s) because you'll have to find or create the correct
objects to pass to all those constructors. It does sound like a pain but
unfortunately there's no way for JiBX to know how to call specialized
constructors. Potentially JiBX could be enhanced to optionally add
do-nothing no-arg constructors to the class bytecode, but I think the
bytecode generation is going to be re-done in the next major release, so
I don't think you'll see that feature added to the current codebase.

The best thing I can suggest is find a way to automate the process.
Writing and testing the binding(s) for 100's of classes is no trivial
task either. I think adding a no arg constructor to those classes is an
effort on the same scale. A tool like Intellij Idea can mark all of your
classes for you that are missing a no arg constructor, and although it
can't fix them all at the same time, it can generate a constructor for
the class you are currently in, and you could bind that action to a
key-stroke. I believe Eclipse can do similar things.

Mocky



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Kumar
Sent: Friday, July 29, 2005 9:16 AM
To: [email protected]
Subject: [jibx-users] JiBXException: Need no-argument constructor or
factory for


Hi,

I am using JiBX RC0. When using the ant task for running the JiBX
binding compiler I have below error.  The error asks me to add
no-argument constructor for com.supz.Token. But I have legacy API which
has 100's of classes and it can be nightmare if I add no-argument
constructor to these classes. Can anyone please tell how can I do
without adding no-argument constructor or any workaround ...


     [bind] Generating code for mapping com.supz.Token
     [bind] Error running binding compiler
     [bind] org.jibx.runtime.JiBXException: Need no-argument constructor
or factory for com.supz.Token
     [bind]     at
org.jibx.binding.def.ObjectBinding.genNewInstanceCode(Unknown Source)
     [bind]     at
org.jibx.binding.def.ObjectBinding.genNewInstanceCall(Unknown Source)
     [bind]     at
org.jibx.binding.def.ObjectBinding.genNewInstance(Unknown Source)
     [bind]     at
org.jibx.binding.def.ElementWrapper.genNewInstance(Unknown Source)
     [bind]     at
org.jibx.binding.def.PassThroughComponent.genNewInstance(Unknown
Source)
     [bind]     at
org.jibx.binding.def.MappingDefinition.generateCode(Unknown Source)
     [bind]     at
org.jibx.binding.def.DefinitionContext.generateCode(Unknown Source)
     [bind]     at
org.jibx.binding.def.BindingDefinition.generateCode(Unknown Source)
     [bind]     at org.jibx.binding.Compile.compile(Unknown Source)
     [bind]     at org.jibx.binding.ant.CompileTask.execute(Unknown
Source)
     [bind]     at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
     [bind]     at org.apache.tools.ant.Task.perform(Task.java:364)
     [bind]     at org.apache.tools.ant.Target.execute(Target.java:341)
     [bind]     at
org.apache.tools.ant.Target.performTasks(Target.java:369)
     [bind]     at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
     [bind]     at
org.apache.tools.ant.Project.executeTarget(Project.java:1185)
     [bind]     at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecut
or.java:40)
     [bind]     at
org.apache.tools.ant.Project.executeTargets(Project.java:1068)
     [bind]     at org.apache.tools.ant.Main.runBuild(Main.java:668)
     [bind]     at org.apache.tools.ant.Main.startAnt(Main.java:187)
     [bind]     at
org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
     [bind]     at
org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
     
     
     
     
Thanks & Regards,
Kr.


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle
Practices Agile & Plan-Driven Development * Managing Projects & Teams *
Testing & QA Security * Process Improvement & Measurement *
http://www.sqe.com/bsce5sf
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September
19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to