Package com.sun.tools.xjc.util

Examples of com.sun.tools.xjc.util.CodeModelClassFactory


    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());
View Full Code Here


  private final JDefinedClass classBooleanConverter;

  public ClazzPool(final Outline outline) {
    final JPackage kmlpackage = Util.getKmlClassPackage(outline);
    final CodeModelClassFactory classFactory = outline.getClassFactory();
    final JPackage ppp = outline.getCodeModel()._package(kmlpackage.getPackage().name() + ".annotations");
    classObviousAnnotation = classFactory.createClass(ppp, JMod.PUBLIC, "Obvious", null, ClassType.ANNOTATION_TYPE_DECL);
    classObviousAnnotation.annotate(Target.class).param("value", ElementType.FIELD).param("value", ElementType.METHOD);
    classCoordinateConverter = classFactory.createClass(kmlpackage, JMod.PUBLIC | JMod.FINAL, "CoordinatesConverter", null, ClassType.CLASS);
    classBooleanConverter = classFactory.createClass(kmlpackage, JMod.PUBLIC | JMod.FINAL, "BooleanConverter", null, ClassType.CLASS);
   
    for (final ClassOutline classOutline : outline.getClasses()) {
      final ClassOutlineImpl cc = (ClassOutlineImpl) classOutline;

      if (cc.implRef.name().equals("Coordinate")) {
View Full Code Here

            Ring.add(XSSchemaSet.class,_schemas);
            Ring.add(codeModel);
            Model model = new Model(opts, codeModel, null/*set later*/, opts.classNameAllocator, _schemas);
            Ring.add(model);
            Ring.add(ErrorReceiver.class,ef);
            Ring.add(CodeModelClassFactory.class,new CodeModelClassFactory(ef));

            BGMBuilder builder = new BGMBuilder(opts.defaultPackage,opts.defaultPackage2,
                opts.isExtensionMode(),opts.getFieldRendererFactory(), opts.activePlugins);
            builder._build();

View Full Code Here

    private BeanGenerator(Model _model, ErrorReceiver _errorReceiver) {

        this.model = _model;
        this.codeModel = model.codeModel;
        this.errorReceiver = _errorReceiver;
        this.codeModelClassFactory = new CodeModelClassFactory(errorReceiver);

        // build enum classes
        for( CEnumLeafInfo p : model.enums().values() )
            enums.put( p, generateEnumDef(p) );
View Full Code Here

    public BindInfo(Model model, Document _dom, ErrorReceiver _errorReceiver) {
        this.model = model;
        this.dom = _dom.getDocumentElement();
        this.codeModel = model.codeModel;
        this.errorReceiver = _errorReceiver;
        this.classFactory = new CodeModelClassFactory(_errorReceiver);
        // TODO: decide name converter from the binding file

        this.defaultPackage = model.options.defaultPackage;

        // copy global customizations to the model
View Full Code Here

            Ring.add(XSSchemaSet.class,_schemas);
            Ring.add(codeModel);
            Model model = new Model(opts, codeModel, null/*set later*/, opts.classNameAllocator, _schemas);
            Ring.add(model);
            Ring.add(ErrorReceiver.class,ef);
            Ring.add(CodeModelClassFactory.class,new CodeModelClassFactory(ef));

            BGMBuilder builder = new BGMBuilder(opts.defaultPackage,opts.defaultPackage2,
                opts.isExtensionMode(),opts.getFieldRendererFactory(), opts.activePlugins);
            builder._build();

View Full Code Here

    protected TDTDReader(ErrorReceiver errorReceiver, Options opts, InputSource _bindInfo)
        throws AbortException {
        this.entityResolver = opts.entityResolver;
        this.errorReceiver = new ErrorReceiverFilter(errorReceiver);
        bindInfo = new BindInfo(model,_bindInfo, this.errorReceiver);
        classFactory = new CodeModelClassFactory(errorReceiver);
    }
View Full Code Here

    private BeanGenerator(Model _model, ErrorReceiver _errorReceiver) {

        this.model = _model;
        this.codeModel = model.codeModel;
        this.errorReceiver = _errorReceiver;
        this.codeModelClassFactory = new CodeModelClassFactory(errorReceiver);

        // build enum classes
        for( CEnumLeafInfo p : model.enums().values() )
            enums.put( p, generateEnumDef(p) );
View Full Code Here

            Ring.add(XSSchemaSet.class,_schemas);
            Ring.add(codeModel);
            Model model = new Model(opts, codeModel, null/*set later*/, opts.classNameAllocator, _schemas);
            Ring.add(model);
            Ring.add(ErrorReceiver.class,ef);
            Ring.add(CodeModelClassFactory.class,new CodeModelClassFactory(ef));

            BGMBuilder builder = new BGMBuilder(opts.defaultPackage,opts.defaultPackage2,
                opts.isExtensionMode(),opts.getFieldRendererFactory());
            builder._build();

View Full Code Here

            Ring.add(XSSchemaSet.class,_schemas);
            Ring.add(codeModel);
            Model model = new Model(opts, codeModel, null/*set later*/, opts.classNameAllocator, _schemas);
            Ring.add(model);
            Ring.add(ErrorReceiver.class,ef);
            Ring.add(CodeModelClassFactory.class,new CodeModelClassFactory(ef));

            BGMBuilder builder = new BGMBuilder(opts.defaultPackage,opts.defaultPackage2,
                opts.isExtensionMode(),opts.getFieldRendererFactory(), opts.activePlugins);
            builder._build();

View Full Code Here

TOP

Related Classes of com.sun.tools.xjc.util.CodeModelClassFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.