Static factory methods in JAXB MOXy?

Thank you for entering a bug for this issue ( https://bugs.eclipse. Org/36298 4). The issue has been fixed in the EclipseLink 2.4 stream, and will be backported today (Nov 9, 2011) to the EclipseLink 2.3.2 stream.

You can try out the fix obtaining a nightly download from.

Thank you for entering a bug for this issue (https://bugs.eclipse. Org/362984). The issue has been fixed in the EclipseLink 2.4 stream, and will be backported today (Nov 9, 2011) to the EclipseLink 2.3.2 stream.

You can try out the fix obtaining a nightly download from: eclipse.org/eclipselink/downloads/nightl... Now if you specify a factory class using the @XmlType annotation like: @XmlType(factoryClass=DummyFactory. Class, factoryMethod="createNew") public abstract MyClass() { } The following types of factory classes are supported: Factory with Static Methods With this bug fix, when MOXy uses the factory method to create an instance of MyClass an instance of DummyFactory is not created. Public abstract class DummyFactory { public static MyClass createNew() { // code for returning a new instance of MyClass } } Factory with Instance Methods In addition to static methods, MOXy allows you to specify instance level creation methods.

For these methods MOXy will create an instance of the factory class. Public class DummyFactory { public MyClass createNew() { // code for returning a new instance of MyClass } } This configuration is not allowed in the JAXB RI, and you will get the following exception: Exception in thread "main" com.sun.xml.internal.bind. V2.runtime.

IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions Factory class "forum8022136. DummyFactory" does not have static zero args factory method "createNew". This problem is related to the following location: at forum8022136.

MyClass at com.sun.xml.internal.bind. V2.runtime. IllegalAnnotationsException$Builder.

Check(IllegalAnnotationsException. Java:91) at com.sun.xml.internal.bind. V2.runtime.JAXBContextImpl.

GetTypeInfoSet(JAXBContextImpl. Java:436) at com.sun.xml.internal.bind. V2.runtime.JAXBContextImpl.(JAXBContextImpl.

Java:277) at com.sun.xml.internal.bind. V2.runtime. JAXBContextImpl$JAXBContextBuilder.

Build(JAXBContextImpl. Java:1100) at com.sun.xml.internal.bind. V2.ContextFactory.

CreateContext(ContextFactory. Java:143) at com.sun.xml.internal.bind. V2.ContextFactory.

CreateContext(ContextFactory. Java:110) at sun.reflect. NativeMethodAccessorImpl.

Invoke0(Native Method) at sun.reflect. NativeMethodAccessorImpl. Invoke(NativeMethodAccessorImpl.

Java:39) at sun.reflect. DelegatingMethodAccessorImpl. Invoke(DelegatingMethodAccessorImpl.

Java:25) at java.lang.reflect.Method. Invoke(Method. Java:597) at javax.xml.bind.ContextFinder.

NewInstance(ContextFinder. Java:202) at javax.xml.bind.ContextFinder. Find(ContextFinder.

Java:376) at javax.xml.bind.JAXBContext. NewInstance(JAXBContext. Java:574) at javax.xml.bind.JAXBContext.

NewInstance(JAXBContext. Java:522) at forum8022136.Demo. Main(Demo.

Java:14).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions