private void addSetRootMethod() { Method m = SourceFactory.newMethod("setRoot", TypeFactory.newVoidType(pack)); m.setAccessLevel(AccessLevel.PUBLIC); Type t = TypeFactory.newReferenceType( pack, "de.realityinabox.databinding.libs.XMLElement", "XMLElement"); m.addArgument(SourceFactory.newVariable("root", t)); m.addSourceLine("this._root = root;"); addMethod(m); }
private void addGetRootMethod() { Method m = SourceFactory.newMethod( "getRoot", TypeFactory.newReferenceType( pack, "de.realityinabox.databinding.libs.XMLElement", "XMLElement")); m.setAccessLevel(AccessLevel.PUBLIC); m.addSourceLine("return _root;"); addMethod(m); }
private void addGetParseStackMethod() { Method m = SourceFactory.newMethod( "getParseStack", TypeFactory.newReferenceType( pack, "de.realityinabox.databinding.libs.ParseStack", "ParseStack")); m.setAccessLevel(AccessLevel.PUBLIC); m.addSourceLine("return _parseStack;"); addMethod(m); }
private void addStartElementMethod() { Method m = SourceFactory.newMethod("startElement", TypeFactory.newVoidType(pack)); m.setAccessLevel(AccessLevel.PUBLIC); Type t = TypeFactory.newReferenceType(pack, "java.lang.String", "String"); m.addArgument(SourceFactory.newVariable("namespaceURI", t)); m.addArgument(SourceFactory.newVariable("localName", t)); m.addArgument(SourceFactory.newVariable("qName", t)); t = TypeFactory.newReferenceType(pack, "org.xml.sax.Attributes", "Attributes"); m.addArgument(SourceFactory.newVariable("atts", t)); m.addException( TypeFactory.newReferenceType(pack, "org.xml.sax.SAXException", "SAXException")); m.addSourceLine("super.startElement(namespaceURI, localName, qName, atts);"); m.addSourceLine("if (_root != null) return;"); // ... MyHandlerClass.defaultStartElementCode(m, "_root"); m.addSourceLine("_parseStack.push(_root);"); addMethod(m); }
private void addStartDocumentMethod() { Method m = SourceFactory.newMethod("startDocument", TypeFactory.newVoidType(pack)); m.setAccessLevel(AccessLevel.PUBLIC); m.addSourceLine("_root = null;"); addMethod(m); }