public JavaSource getJavaSource() { return javaSource; }
public ComplexTypeSG getType() { return ctSG; }
public JavaMethod newGetAttributesMethod() throws SAXException {
JavaMethod jm = getJavaSource().newJavaMethod("getAttributes", AttributesImpl.class, JavaSource.PUBLIC);
final DirectAccessible pController = jm.addParam(JMSAXDriverController.class, "pController");
DirectAccessible pObject = jm.addParam(Object.class, "pObject");
jm.addThrows(SAXException.class);
final LocalJavaField result = jm.newJavaField(AttributesImpl.class);
result.addLine("new ", AttributesImpl.class, "()");
AttributeSG[] myAttributes = ctSG.getAttributes();
if (myAttributes.length > 0) {
JavaQName elementInterface = ctSG.getClassContext().getXMLInterfaceName();
LocalJavaField element = jm.newJavaField(elementInterface);
element.addLine("(", elementInterface, ") ", pObject);
for (int i = 0; i < myAttributes.length; i++) {
final AttributeSG attribute = myAttributes[i];
if (attribute.isWildcard()) {
LocalJavaField anyAttributes = jm.newJavaField(WildcardAttribute[].class);
anyAttributes.addLine(element, ".", attribute.getPropertySG().getXMLGetMethodName() + "Array", "()");
DirectAccessible index = jm.addForArray(anyAttributes);
LocalJavaField wildcardAttribute = jm.newJavaField(WildcardAttribute.class);
wildcardAttribute.addLine(anyAttributes, "[", index, "]");
LocalJavaField qName = jm.newJavaField(QName.class);
qName.addLine(wildcardAttribute, ".getName()");
LocalJavaField uri = jm.newJavaField(String.class);