On Saturday, August 16, 2003, at 10:03 am, Jason Dillon wrote:
How would I go about building a set of objects in the xbeans module just by api and completely outside of XML?
EjbJar ejbJar = EjbJar.Factory.newInstance();
AssemblyDescriptorType assemblyDescriptor = ejbJar.addNewAssemblyDescriptor();
SecurityRole securityRole = assemblyDescriptor.addNewSecurityRole();
securityRole.setRoleName("foo");
...
etc.
Once you've made a bean you can use getters/setters. I like the helper methods to add new content to an existing bean.
Am not sure if the Factory thing is required to instantiate new beans - I hope there can be a default constructor on the bean implementations so that they really are normal beans. Though the nice thing about the Factory approach is you can just use the generated interfaces in your code & not refer to the implementation classes directly.
Is this possible?
Absolutely - this is the point of XMLBeans :)
If so, are there any problems which might arise from doing so?
Not that I'm aware of.
James ------- http://radio.weblogs.com/0112098/
