Package com.sun.codemodel

Examples of com.sun.codemodel.JTryBlock.body()


    generateMarshalOutputStream.javadoc().append(comment);

    // try {
    final JTryBlock tryBlock = generateMarshalOutputStream.body()._try();
    // m = this.createMarshaller();
    tryBlock.body().assign(mVar, JExpr._this().invoke(createMashaller));

    // JAXBElement<Kml> jaxbRootElement = new JAXBElement<Kml>(new QName("http://www.opengis.net/kml/2.2", "kml"), Kml.class, this);
//    JInvocation newJaxbElement = JExpr._new(jaxbElementClass).arg(createQName("http://www.opengis.net/kml/2.2", "kml")).arg(
//        kmlClass.boxify().dotclass()).arg(JExpr._this());
//    final JVar jaxbRootElementVar = tryBlock.body().decl(jaxbElementClass, "jaxbRootElement", newJaxbElement);
View Full Code Here


//    JInvocation newJaxbElement = JExpr._new(jaxbElementClass).arg(createQName("http://www.opengis.net/kml/2.2", "kml")).arg(
//        kmlClass.boxify().dotclass()).arg(JExpr._this());
//    final JVar jaxbRootElementVar = tryBlock.body().decl(jaxbElementClass, "jaxbRootElement", newJaxbElement);

    // m.marshal(jaxbRootElement, outputStream);
    tryBlock.body().add(mVar.invoke("marshal").arg(JExpr._this()).arg(systemClass.boxify().staticRef("out")));

    // return true;
    tryBlock.body()._return(JExpr.TRUE);

    // } catch (JAXBException _x) {
View Full Code Here

    // m.marshal(jaxbRootElement, outputStream);
    tryBlock.body().add(mVar.invoke("marshal").arg(JExpr._this()).arg(systemClass.boxify().staticRef("out")));

    // return true;
    tryBlock.body()._return(JExpr.TRUE);

    // } catch (JAXBException _x) {
    final JBlock catchBlock = tryBlock._catch(jaxbExceptionClass.boxify()).body();
    catchBlock.directStatement("_x.printStackTrace();");
    catchBlock._return(JExpr.FALSE);
View Full Code Here

    final JVar value = generateMarshalOutputStream.param(JMod.FINAL, argumentType, argumentType.name().toLowerCase());

    // try {
    final JTryBlock tryBlock = generateMarshalOutputStream.body()._try();
    // m = this.createMarshaller();
    tryBlock.body().assign(mVar, JExpr._this().invoke(createMashaller));

    // JAXBElement<Kml> jaxbRootElement = new JAXBElement<Kml>(new QName("http://www.opengis.net/kml/2.2", "kml"), Kml.class, this);
//    JInvocation newJaxbElement = JExpr._new(jaxbElementClass).arg(createQName("http://www.opengis.net/kml/2.2", "kml")).arg(
//        kmlClass.boxify().dotclass()).arg(JExpr._this());
//    final JVar jaxbRootElementVar = tryBlock.body().decl(jaxbElementClass, "jaxbRootElement", newJaxbElement);
View Full Code Here

//    JInvocation newJaxbElement = JExpr._new(jaxbElementClass).arg(createQName("http://www.opengis.net/kml/2.2", "kml")).arg(
//        kmlClass.boxify().dotclass()).arg(JExpr._this());
//    final JVar jaxbRootElementVar = tryBlock.body().decl(jaxbElementClass, "jaxbRootElement", newJaxbElement);

    // m.marshal(jaxbRootElement, outputStream);
    tryBlock.body().add(mVar.invoke("marshal").arg(JExpr._this()).arg(value));

    // return true;
    tryBlock.body()._return(JExpr.TRUE);

    // } catch (JAXBException _x) {
View Full Code Here

    // m.marshal(jaxbRootElement, outputStream);
    tryBlock.body().add(mVar.invoke("marshal").arg(JExpr._this()).arg(value));

    // return true;
    tryBlock.body()._return(JExpr.TRUE);

    // } catch (JAXBException _x) {
    final JBlock catchBlock = tryBlock._catch(jaxbExceptionClass.boxify()).body();
    catchBlock.directStatement("_x.printStackTrace();");
    catchBlock._return(JExpr.FALSE);
View Full Code Here

    generateUnMarshallerFromString.javadoc().trimToSize();
   
    final JVar fileunmarshallVar = generateUnMarshallerFromString.param(JMod.FINAL, fileClass, "file");
    generateUnMarshallerFromString._throws(FileNotFoundException.class);
    final JTryBlock tryBlock = generateUnMarshallerFromString.body()._try();
    final JVar localUnmarshallerFile = tryBlock.body().decl(jaxbUnmarshallerClass, "unmarshaller",
        jaxbContextClass.boxify().staticInvoke("newInstance").arg(JExpr.direct("Kml.class")).invoke("createUnmarshaller"));
   
    final JVar inputsource = tryBlock.body().decl(inputsourceClass, "input", JExpr._new(inputsourceClass).arg(JExpr._new(fileReaderClass).arg(fileunmarshallVar)));
    final JVar saxsource = tryBlock.body().decl(saxsourceClass, "saxSource", JExpr._new(saxsourceClass).arg(JExpr._new(namespaceFilterXMLReaderclass).arg(JExpr.FALSE)).arg(inputsource));
    final JVar decl = tryBlock.body().decl(kmlClass, "jaxbRootElement", JExpr.cast(kmlClass, JExpr.invoke(localUnmarshallerFile, "unmarshal").arg(saxsource)));
View Full Code Here

    generateUnMarshallerFromString._throws(FileNotFoundException.class);
    final JTryBlock tryBlock = generateUnMarshallerFromString.body()._try();
    final JVar localUnmarshallerFile = tryBlock.body().decl(jaxbUnmarshallerClass, "unmarshaller",
        jaxbContextClass.boxify().staticInvoke("newInstance").arg(JExpr.direct("Kml.class")).invoke("createUnmarshaller"));
   
    final JVar inputsource = tryBlock.body().decl(inputsourceClass, "input", JExpr._new(inputsourceClass).arg(JExpr._new(fileReaderClass).arg(fileunmarshallVar)));
    final JVar saxsource = tryBlock.body().decl(saxsourceClass, "saxSource", JExpr._new(saxsourceClass).arg(JExpr._new(namespaceFilterXMLReaderclass).arg(JExpr.FALSE)).arg(inputsource));
    final JVar decl = tryBlock.body().decl(kmlClass, "jaxbRootElement", JExpr.cast(kmlClass, JExpr.invoke(localUnmarshallerFile, "unmarshal").arg(saxsource)));
    tryBlock.body()._return(decl);
    tryBlock._catch(saxExceptionClass.boxify()).body().directStatement("_x.printStackTrace();");
    tryBlock._catch(parserConfigurationExceptionClass.boxify()).body().directStatement("_x.printStackTrace();");
View Full Code Here

    final JTryBlock tryBlock = generateUnMarshallerFromString.body()._try();
    final JVar localUnmarshallerFile = tryBlock.body().decl(jaxbUnmarshallerClass, "unmarshaller",
        jaxbContextClass.boxify().staticInvoke("newInstance").arg(JExpr.direct("Kml.class")).invoke("createUnmarshaller"));
   
    final JVar inputsource = tryBlock.body().decl(inputsourceClass, "input", JExpr._new(inputsourceClass).arg(JExpr._new(fileReaderClass).arg(fileunmarshallVar)));
    final JVar saxsource = tryBlock.body().decl(saxsourceClass, "saxSource", JExpr._new(saxsourceClass).arg(JExpr._new(namespaceFilterXMLReaderclass).arg(JExpr.FALSE)).arg(inputsource));
    final JVar decl = tryBlock.body().decl(kmlClass, "jaxbRootElement", JExpr.cast(kmlClass, JExpr.invoke(localUnmarshallerFile, "unmarshal").arg(saxsource)));
    tryBlock.body()._return(decl);
    tryBlock._catch(saxExceptionClass.boxify()).body().directStatement("_x.printStackTrace();");
    tryBlock._catch(parserConfigurationExceptionClass.boxify()).body().directStatement("_x.printStackTrace();");
    tryBlock._catch(jaxbExceptionClass.boxify()).body().directStatement("_x.printStackTrace();");
View Full Code Here

    final JVar localUnmarshallerFile = tryBlock.body().decl(jaxbUnmarshallerClass, "unmarshaller",
        jaxbContextClass.boxify().staticInvoke("newInstance").arg(JExpr.direct("Kml.class")).invoke("createUnmarshaller"));
   
    final JVar inputsource = tryBlock.body().decl(inputsourceClass, "input", JExpr._new(inputsourceClass).arg(JExpr._new(fileReaderClass).arg(fileunmarshallVar)));
    final JVar saxsource = tryBlock.body().decl(saxsourceClass, "saxSource", JExpr._new(saxsourceClass).arg(JExpr._new(namespaceFilterXMLReaderclass).arg(JExpr.FALSE)).arg(inputsource));
    final JVar decl = tryBlock.body().decl(kmlClass, "jaxbRootElement", JExpr.cast(kmlClass, JExpr.invoke(localUnmarshallerFile, "unmarshal").arg(saxsource)));
    tryBlock.body()._return(decl);
    tryBlock._catch(saxExceptionClass.boxify()).body().directStatement("_x.printStackTrace();");
    tryBlock._catch(parserConfigurationExceptionClass.boxify()).body().directStatement("_x.printStackTrace();");
    tryBlock._catch(jaxbExceptionClass.boxify()).body().directStatement("_x.printStackTrace();");
    generateUnMarshallerFromString.body()._return(JExpr._null());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.