1 16 17 package org.apache.ws.jaxme.generator.sg.impl; 18 19 import org.apache.ws.jaxme.generator.sg.ObjectSG; 20 import org.apache.ws.jaxme.generator.sg.PropertySG; 21 import org.apache.ws.jaxme.js.JavaField; 22 import org.apache.ws.jaxme.js.JavaMethod; 23 import org.apache.ws.jaxme.js.JavaSource; 24 import org.apache.ws.jaxme.js.Parameter; 25 import org.apache.ws.jaxme.xs.XSAny; 26 import org.xml.sax.SAXException ; 27 28 31 public class AnyElementPropertySG extends JAXBPropertySG { 32 protected AnyElementPropertySG(ObjectSG pObjectSG, XSAny pAny) { 33 super("any", pObjectSG.getSchema(), pAny, null, null); 34 } 35 36 public JavaField getXMLField(PropertySG pController, JavaSource pSource) throws SAXException { 37 String fieldName = pController.getXMLFieldName(); 38 JavaField result = pSource.newJavaField(fieldName, Object .class, JavaSource.PRIVATE); 39 return result; 40 } 41 42 public JavaMethod getXMLGetMethod(PropertySG pController, JavaSource pSource) throws SAXException { 43 String fieldName = pController.getXMLFieldName(); 44 String methodName = pController.getXMLGetMethodName(); 45 JavaMethod result = pSource.newJavaMethod(methodName, Object .class, JavaSource.PUBLIC); 46 result.addLine("return ", fieldName, ";"); 47 return result; 48 } 49 50 public JavaMethod getXMLSetMethod(PropertySG pController, JavaSource pSource) throws SAXException { 51 String fieldName = pController.getXMLFieldName(); 52 String methodName = pController.getXMLSetMethodName(); 53 JavaMethod result = pSource.newJavaMethod(methodName, void.class, JavaSource.PUBLIC); 54 Parameter param = result.addParam(Object .class, "p" + Character.toUpperCase(fieldName.charAt(0)) + fieldName.substring(1)); 55 result.addLine(fieldName, " = ", param, ";"); 56 return result; 57 } 58 } 59 | Popular Tags |