fileReaderClass = codeModel._ref(FileReader.class);
saxsourceClass = codeModel._ref(SAXSource.class);
saxParserFactoryClass = codeModel._ref(SAXParserFactory.class);
parserConfigurationExceptionClass = codeModel._ref(ParserConfigurationException.class);
final CodeModelClassFactory classFactory = outline.getClassFactory();
final JPackage kmlpackage = Util.getKmlClassPackage(outline);
namespaceFilterHandler = classFactory.createClass(kmlpackage, JMod.FINAL, "NamespaceFilterHandler", null, ClassType.CLASS);
namespaceFilterHandler._implements(contentHandlerClass.boxify());
final JFieldVar KML_20 = namespaceFilterHandler.field(JMod.PRIVATE | JMod.STATIC | JMod.FINAL, stringClass, "KML_20", JExpr.lit("http://earth.google.com/kml/2.0"));
final JFieldVar KML_21 = namespaceFilterHandler.field(JMod.PRIVATE | JMod.STATIC | JMod.FINAL, stringClass, "KML_21", JExpr.lit("http://earth.google.com/kml/2.1"));
final JFieldVar KML_22 = namespaceFilterHandler.field(JMod.PRIVATE | JMod.STATIC | JMod.FINAL, stringClass, "KML_22", JExpr.lit("http://www.opengis.net/kml/2.2"));
final JFieldVar content = namespaceFilterHandler.field(JMod.PRIVATE, contentHandlerClass, "contentHandler");
final JMethod constructor = namespaceFilterHandler.constructor(JMod.PUBLIC);
final JVar constructorParam = constructor.param(contentHandlerClass, "contentHandler");
constructor.body().assign(JExpr._this().ref(content), constructorParam);
final JMethod startElement = namespaceFilterHandler.method(JMod.PUBLIC, cc.implClass.owner().VOID, "startElement");
startElement._throws(SAXException.class);
final JVar uri = startElement.param(stringClass, "uri");
final JVar localName = startElement.param(stringClass, "localName");
final JVar qName = startElement.param(stringClass, "qName");
final JVar atts = startElement.param(Attributes.class, "atts");
final JConditional if1 = startElement.body()._if(uri.invoke("equals").arg(KML_20).cor(uri.invoke("equals").arg(KML_21)));
if1._then().block().add(content.invoke("startElement").arg(KML_22).arg(localName).arg(qName).arg(atts));
if1._else().block().add(content.invoke("startElement").arg(uri).arg(localName).arg(qName).arg(atts));
final JMethod characters = namespaceFilterHandler.method(JMod.PUBLIC, cc.implClass.owner().VOID, "characters");
final JVar charCh = characters.param(cc.implClass.owner().CHAR.array(), "ch");
final JVar charStart = characters.param(cc.implClass.owner().INT, "start");
final JVar charLength = characters.param(cc.implClass.owner().INT, "length");
characters._throws(saxExceptionClass.boxify());
characters.body().add(content.invoke("characters").arg(charCh).arg(charStart).arg(charLength));
final JMethod endDocument = namespaceFilterHandler.method(JMod.PUBLIC, cc.implClass.owner().VOID, "endDocument");
endDocument._throws(saxExceptionClass.boxify());
endDocument.body().add(content.invoke("endDocument"));
final JMethod endElement = namespaceFilterHandler.method(JMod.PUBLIC, cc.implClass.owner().VOID, "endElement");
final JVar endElementUri = endElement.param(stringClass, "uri");
final JVar endElementLocalName = endElement.param(stringClass, "localName");
final JVar endElementqName = endElement.param(stringClass, "qName");
endElement._throws(saxExceptionClass.boxify());
endElement.body().add(content.invoke("endElement").arg(endElementUri).arg(endElementLocalName).arg(endElementqName));
final JMethod endPrefixMapping = namespaceFilterHandler.method(JMod.PUBLIC, cc.implClass.owner().VOID, "endPrefixMapping");
final JVar endPrefixMappingPrefix = endPrefixMapping.param(stringClass, "prefix");
endPrefixMapping._throws(saxExceptionClass.boxify());
endPrefixMapping.body().add(content.invoke("endPrefixMapping").arg(endPrefixMappingPrefix));
final JMethod ignorableWhitespace = namespaceFilterHandler.method(JMod.PUBLIC, cc.implClass.owner().VOID, "ignorableWhitespace");
final JVar ignorableWhitespaceCh = ignorableWhitespace.param(cc.implClass.owner().CHAR.array(), "ch");
final JVar ignorableWhitespaceStart = ignorableWhitespace.param(cc.implClass.owner().INT, "start");
final JVar ignorableWhitespaceLength = ignorableWhitespace.param(cc.implClass.owner().INT, "length");
ignorableWhitespace._throws(saxExceptionClass.boxify());
ignorableWhitespace.body().add(content.invoke("ignorableWhitespace").arg(ignorableWhitespaceCh).arg(ignorableWhitespaceStart).arg(ignorableWhitespaceLength));
final JMethod processingInstruction = namespaceFilterHandler.method(JMod.PUBLIC, cc.implClass.owner().VOID, "processingInstruction");
final JVar processingInstructionTarget = processingInstruction.param(stringClass, "target");
final JVar processingInstructionData = processingInstruction.param(stringClass, "data");
processingInstruction._throws(saxExceptionClass.boxify());
processingInstruction.body().add(content.invoke("processingInstruction").arg(processingInstructionTarget).arg(processingInstructionData));
final JMethod setDocumentLocator = namespaceFilterHandler.method(JMod.PUBLIC, cc.implClass.owner().VOID, "setDocumentLocator");
final JVar setDocumentLocatorLocator = setDocumentLocator.param(Locator.class, "locator");
setDocumentLocator.body().add(content.invoke("setDocumentLocator").arg(setDocumentLocatorLocator));
final JMethod skippedEntity = namespaceFilterHandler.method(JMod.PUBLIC, cc.implClass.owner().VOID, "skippedEntity");
final JVar skippedEntityName = skippedEntity.param(stringClass, "name");
skippedEntity._throws(saxExceptionClass.boxify());
skippedEntity.body().add(content.invoke("skippedEntity").arg(skippedEntityName));
final JMethod startDocument = namespaceFilterHandler.method(JMod.PUBLIC, cc.implClass.owner().VOID, "startDocument");
startDocument._throws(saxExceptionClass.boxify());
startDocument.body().add(content.invoke("startDocument"));
final JMethod startPrefixMapping = namespaceFilterHandler.method(JMod.PUBLIC, cc.implClass.owner().VOID, "startPrefixMapping");
final JVar startPrefixMappingPrefix = startPrefixMapping.param(stringClass, "prefix");
final JVar startPrefixMappingUri = startPrefixMapping.param(stringClass, "uri");
startPrefixMapping._throws(saxExceptionClass.boxify());
startPrefixMapping.body().add(content.invoke("startPrefixMapping").arg(startPrefixMappingPrefix).arg(startPrefixMappingUri));
namespaceFilterXMLReaderclass = classFactory.createClass(kmlpackage, JMod.FINAL, "NamespaceFilterXMLReader", null, ClassType.CLASS);
namespaceFilterXMLReaderclass._implements(xmlReaderClass.boxify());
final JFieldVar xmlReader = namespaceFilterXMLReaderclass.field(JMod.PRIVATE, xmlReaderClass, "xmlReader");
final JMethod namespaceFilterXMLReaderclassConstrutor = namespaceFilterXMLReaderclass.constructor(JMod.PUBLIC);
final JVar paramValidate = namespaceFilterXMLReaderclassConstrutor.param(cc.implClass.owner().BOOLEAN, "validate");
namespaceFilterXMLReaderclassConstrutor._throws(saxExceptionClass.boxify())._throws(parserConfigurationExceptionClass.boxify());