You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jaxme-dev@ws.apache.org by jo...@apache.org on 2005/04/19 22:11:14 UTC
cvs commit: ws-jaxme/src/jaxme/org/apache/ws/jaxme/examples/misc/address AddressCreator.java
jochen 2005/04/19 13:11:14
Modified: . status.xml
src/jaxme/org/apache/ws/jaxme/generator/sg/impl
JAXBSchemaSG.java
src/jaxme/org/apache/ws/jaxme/examples/misc/address
AddressCreator.java
Log:
Fixed that the object factory methods didn't work for inner classes.
Revision Changes Path
1.46 +12 -0 ws-jaxme/status.xml
Index: status.xml
===================================================================
RCS file: /home/cvs/ws-jaxme/status.xml,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- status.xml 12 Apr 2005 08:17:17 -0000 1.45
+++ status.xml 19 Apr 2005 20:11:14 -0000 1.46
@@ -22,6 +22,7 @@
<person name="Davanum Srinivas" email="dims at yahoo.com" id="DS" />
<person name="Robert Burrell Donkin" email="rdonkin at apache.org" id="RD" />
<person name="Changshin Lee (Ias)" email="iasandcb at tmax.co.kr" id="CL" />
+ <person name="Nacho G. Mac Dowell" email="" id="NM" />
<!-- Add more people here -->
</developers>
@@ -29,6 +30,17 @@
</todo>
<changes>
+ <release version="0.4" date="Not yet published">
+ <action dev="JW" type="fix" context="generator">
+ Fixed that the object factory methods didn't work for
+ inner classes.
+ </action>
+ <action dev="JW" type="fix" context="generator">
+ Fixed a "Not implemented" IllegalStateException in the
+ UnmarshallerHandlerImpl, which caused unmarshalling of
+ nested groups to fail in some cases.
+ </action>
+ </release>
<release version="0.4beta" date="2005-Apr-17">
<action dev="JW" type="enhancement" context="generator">
The ObjectFactory does now contain methods for creating
1.16 +7 -2 ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBSchemaSG.java
Index: JAXBSchemaSG.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBSchemaSG.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- JAXBSchemaSG.java 9 Apr 2005 00:42:43 -0000 1.15
+++ JAXBSchemaSG.java 19 Apr 2005 20:11:14 -0000 1.16
@@ -579,13 +579,18 @@
JavaQName resultName = pContext.getXMLInterfaceName();
String className = resultName.isInnerClass() ? resultName.getInnerClassName() : resultName.getClassName();
String result = Character.toUpperCase(className.charAt(0)) + className.substring(1);
- if (pPrefix != null) {
+ boolean anonymous = pPrefix != null;
+ if (anonymous) {
result = pPrefix + result;
}
String methodName = "create" + result;
JavaMethod createMethod = pSource.newJavaMethod(methodName, resultName, "public");
createMethod.addThrows(JAXBException.class);
- createMethod.addLine("return (", resultName, ") newInstance(", resultName, ".class);");
+ if (anonymous) {
+ createMethod.addLine("return new ", pContext.getXMLImplementationName(), "();");
+ } else {
+ createMethod.addLine("return (", resultName, ") newInstance(", resultName, ".class);");
+ }
return result;
}
}
1.5 +51 -55 ws-jaxme/src/jaxme/org/apache/ws/jaxme/examples/misc/address/AddressCreator.java
Index: AddressCreator.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/examples/misc/address/AddressCreator.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AddressCreator.java 26 Aug 2004 22:41:25 -0000 1.4
+++ AddressCreator.java 19 Apr 2005 20:11:14 -0000 1.5
@@ -26,64 +26,60 @@
import org.apache.ws.jaxme.impl.JMMarshallerImpl;
import org.apache.ws.jaxme.test.misc.address.Address;
+import org.apache.ws.jaxme.test.misc.address.ObjectFactory;
import org.apache.ws.jaxme.test.misc.address.AddressType.EmailDetailsType.EmailType;
import org.apache.ws.jaxme.test.misc.address.AddressType.PhoneDetailsType.PhoneType;
-import org.apache.ws.jaxme.test.misc.address.impl.AddressImpl;
-import org.apache.ws.jaxme.test.misc.address.impl.AddressTypeImpl.NameTypeImpl;
-import org.apache.ws.jaxme.test.misc.address.impl.AddressTypeImpl.PostalTypeImpl;
-import org.apache.ws.jaxme.test.misc.address.impl.AddressTypeImpl.EmailDetailsTypeImpl;
-import org.apache.ws.jaxme.test.misc.address.impl.AddressTypeImpl.EmailDetailsTypeImpl.EmailTypeImpl;
-import org.apache.ws.jaxme.test.misc.address.impl.AddressTypeImpl.PhoneDetailsTypeImpl;
-import org.apache.ws.jaxme.test.misc.address.impl.AddressTypeImpl.PhoneDetailsTypeImpl.PhoneTypeImpl;
public class AddressCreator {
- public static void writeAddress(Writer pWriter) throws JAXBException {
- // Create the element:
- Address addr = new AddressImpl();
- addr.setName(new NameTypeImpl());
- addr.getName().setFirst("Jane");
- addr.getName().setLast("Doe");
- addr.setPostal(new PostalTypeImpl());
- addr.getPostal().setStreet("34 Main Street");
- addr.getPostal().setCity("Boston");
- addr.getPostal().setState("MA");
- addr.getPostal().setZIP("02215");
- addr.setEmailDetails(new EmailDetailsTypeImpl());
-
- EmailType email = new EmailTypeImpl();
- email.setType("Private");
- email.setEmailAddress("jdoe@yourcompany.com");
- addr.getEmailDetails().getEmail().add(email);
- email = new EmailTypeImpl();
- email.setType("Office");
- email.setEmailAddress("josephdoe@mycompany.com");
- addr.getEmailDetails().getEmail().add(email);
- email = new EmailTypeImpl();
- email.setType("Office");
- email.setEmailAddress("joseph.doe@mycompany.com");
- addr.getEmailDetails().getEmail().add(email);
-
- addr.setPhoneDetails(new PhoneDetailsTypeImpl());
- PhoneType phone = new PhoneTypeImpl();
- phone.setType("Work");
- phone.setPhoneNumber("555.6789");
- addr.getPhoneDetails().getPhone().add(phone);
- phone = new PhoneTypeImpl();
- phone.setType("Fax");
- phone.setPhoneNumber("555.1212");
- addr.getPhoneDetails().getPhone().add(phone);
-
- // And save it into the file "Address.xml"
- JAXBContext context = JAXBContext.newInstance("org.apache.ws.jaxme.test.misc.address");
- Marshaller marshaller = context.createMarshaller();
- marshaller.setProperty(JMMarshallerImpl.JAXME_XML_DECLARATION, Boolean.FALSE);
- marshaller.marshal(addr, pWriter);
- }
-
- public static void main(String[] args) throws Exception {
- FileWriter fw = new FileWriter("Address.xml");
- writeAddress(fw);
- fw.close();
- }
+ public static void writeAddress(Writer pWriter) throws JAXBException {
+ ObjectFactory f = new ObjectFactory();
+
+ // Create the element:
+ Address addr = f.createAddress();
+ addr.setName(f.createAddressTypeNameType());
+ addr.getName().setFirst("Jane");
+ addr.getName().setLast("Doe");
+ addr.setPostal(f.createAddressTypePostalType());
+ addr.getPostal().setStreet("34 Main Street");
+ addr.getPostal().setCity("Boston");
+ addr.getPostal().setState("MA");
+ addr.getPostal().setZIP("02215");
+ addr.setEmailDetails(f.createAddressTypeEmailDetailsType());
+
+ EmailType email = f.createAddressTypeEmailDetailsTypeEmailType();
+ email.setType("Private");
+ email.setEmailAddress("jdoe@yourcompany.com");
+ addr.getEmailDetails().getEmail().add(email);
+ email = f.createAddressTypeEmailDetailsTypeEmailType();
+ email.setType("Office");
+ email.setEmailAddress("josephdoe@mycompany.com");
+ addr.getEmailDetails().getEmail().add(email);
+ email = f.createAddressTypeEmailDetailsTypeEmailType();
+ email.setType("Office");
+ email.setEmailAddress("joseph.doe@mycompany.com");
+ addr.getEmailDetails().getEmail().add(email);
+
+ addr.setPhoneDetails(f.createAddressTypePhoneDetailsType());
+ PhoneType phone = f.createAddressTypePhoneDetailsTypePhoneType();
+ phone.setType("Work");
+ phone.setPhoneNumber("555.6789");
+ addr.getPhoneDetails().getPhone().add(phone);
+ phone = f.createAddressTypePhoneDetailsTypePhoneType();
+ phone.setType("Fax");
+ phone.setPhoneNumber("555.1212");
+ addr.getPhoneDetails().getPhone().add(phone);
+
+ // And save it into the file "Address.xml"
+ JAXBContext context = JAXBContext.newInstance("org.apache.ws.jaxme.test.misc.address");
+ Marshaller marshaller = context.createMarshaller();
+ marshaller.setProperty(JMMarshallerImpl.JAXME_XML_DECLARATION, Boolean.FALSE);
+ marshaller.marshal(addr, pWriter);
+ }
+
+ public static void main(String[] args) throws Exception {
+ FileWriter fw = new FileWriter("Address.xml");
+ writeAddress(fw);
+ fw.close();
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org