Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 332171

Summary: Can't generate a schema if using a factory method and no zero-arg constructor
Product: z_Archived Reporter: Karen Butzke <karenfbutzke>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: david.mccann
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
NoSuchMethodException stack trace
none
Proposed fix
none
Supporting tests none

Description Karen Butzke CLA 2010-12-08 16:23:39 EST
Created attachment 184819 [details]
NoSuchMethodException stack trace

I am using the nightly build .v20101208-r8654. I am attempting to generate a schema using MOXY for the following class with a factory method and no zero-argument constructor. I get the attached exception when EclipseLink attempts to use the zero-arg constructor.

@XmlType(factoryMethod="buildEmployee")
public class Employee {

	private Employee(String name) {
		super();
		this.name = name;
	}

	public static Employee buildEmployee() {
		return new Employee("John");
	}
	private String name;
}
Comment 1 David McCann CLA 2010-12-09 13:34:54 EST
Created attachment 184882 [details]
Proposed fix
Comment 2 David McCann CLA 2010-12-09 13:35:07 EST
Created attachment 184884 [details]
Supporting tests
Comment 3 David McCann CLA 2010-12-09 15:21:12 EST
Reviewed by:  matt.macivor@oracle.com
Tests:  all unit tests pass as expected;  jaxb/xmltype/XmlTypeTestCases
Comment 4 David McCann CLA 2010-12-09 15:25:33 EST
Revision:  8678
Comment 5 Eclipse Webmaster CLA 2022-06-09 10:28:46 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink