Package com.sun.codemodel

Examples of com.sun.codemodel.JCatchBlock


        notNull._then()._return( cm.ref( DatatypeFactory.class ).staticInvoke( "newInstance" ).invoke(
            "newXMLGregorianCalendar" ).arg( calendar ) );

        tryBlock.body()._return( JExpr._null() );

        final JCatchBlock catchBlock = tryBlock._catch( cm.ref( DatatypeConfigurationException.class ) );
        catchBlock.body()._throw( JExpr._new( cm.ref( AssertionError.class ) ).arg( catchBlock.param( "e" ) ) );

        createXMLGregorianCalendar.javadoc().append(
            "Creates a " + XMLGregorianCalendar.class.getName() + " instance from a " + Calendar.class.getName()
            + " instance." );
View Full Code Here


        createProxy.arg(JExpr.direct(epVar.name()).invoke("getBinding"));
        createProxy.arg(JExpr.direct(epVar.name()).invoke("getUrl"));
       
        tryBlock.body()._return(createProxy);

        JCatchBlock catchBlock = tryBlock._catch(model.ref(MalformedURLException.class));
        JType xreType = model._ref(XFireRuntimeException.class);
        JInvocation xreThrow = JExpr._new(xreType);
        xreThrow.arg("Invalid URL");
        xreThrow.arg(catchBlock.param("e"));
       
        catchBlock.body()._throw(xreThrow);
       

        /**
         * T getEndpoint(QName)
         */
 
View Full Code Here

    udfInitTry.body().assign(
      workspaceJVars[0],
      workspaceJVars[1].invoke("initialize")
      .arg(oiArray));

    JCatchBlock udfInitCatch = udfInitTry._catch(m.directClass(Exception.class.getCanonicalName()));
    JVar exVar = udfInitCatch.param("ex");
    udfInitCatch.body()
      ._throw(JExpr._new(m.directClass(RuntimeException.class.getCanonicalName()))
        .arg(JExpr.lit(String.format("Failed to initialize GenericUDF"))).arg(exVar));

    sub.add(ObjectInspectorHelper.initReturnValueHolder(g, m, workspaceJVars[4], returnOI, returnType.getMinorType()));
View Full Code Here

    // create try..catch block to call the GenericUDF instance with given input
    JTryBlock udfEvalTry = sub._try();
    udfEvalTry.body().assign(retVal,
      workspaceJVars[1].invoke("evaluate").arg(workspaceJVars[3]));

    JCatchBlock udfEvalCatch = udfEvalTry._catch(m.directClass(Exception.class.getCanonicalName()));
    JVar exVar = udfEvalCatch.param("ex");
    udfEvalCatch.body()
      ._throw(JExpr._new(m.directClass(RuntimeException.class.getCanonicalName()))
        .arg(JExpr.lit(String.format("GenericUDF.evaluate method failed"))).arg(exVar));

    // get the ValueHolder from retVal and return ObjectInspector
    sub.add(ObjectInspectorHelper.getDrillObject(m, returnOI, workspaceJVars[0], workspaceJVars[4], retVal));
View Full Code Here

        JVar urlVar = staticBlock.decl(cm.ref(URL.class), "url", JExpr._null());
        JVar exVar = staticBlock.decl(cm.ref(WebServiceException.class), "e", JExpr._null());
       
        JTryBlock tryBlock = staticBlock._try();
        tryBlock.body().assign(urlVar, JExpr._new(cm.ref(URL.class)).arg(wsdlLocation));
        JCatchBlock catchBlock = tryBlock._catch(cm.ref(MalformedURLException.class));
        catchBlock.param("ex");
        catchBlock.body().assign(exVar, JExpr._new(cm.ref(WebServiceException.class)).arg(JExpr.ref("ex")));

        staticBlock.assign(urlField, urlVar);
        staticBlock.assign(exField, exVar);
    }
View Full Code Here

    udfInitTry.body().assign(
      workspaceJVars[0],
      workspaceJVars[1].invoke("initialize")
      .arg(oiArray));

    JCatchBlock udfInitCatch = udfInitTry._catch(m.directClass(Exception.class.getCanonicalName()));
    JVar exVar = udfInitCatch.param("ex");
    udfInitCatch.body()
      ._throw(JExpr._new(m.directClass(RuntimeException.class.getCanonicalName()))
        .arg(JExpr.lit(String.format("Failed to initialize GenericUDF"))).arg(exVar));

    sub.add(ObjectInspectorHelper.initReturnValueHolder(m, workspaceJVars[4], returnOI, returnType.getMinorType()));
View Full Code Here

    // create try..catch block to call the GenericUDF instance with given input
    JTryBlock udfEvalTry = sub._try();
    udfEvalTry.body().assign(retVal,
      workspaceJVars[1].invoke("evaluate").arg(workspaceJVars[3]));

    JCatchBlock udfEvalCatch = udfEvalTry._catch(m.directClass(Exception.class.getCanonicalName()));
    JVar exVar = udfEvalCatch.param("ex");
    udfEvalCatch.body()
      ._throw(JExpr._new(m.directClass(RuntimeException.class.getCanonicalName()))
        .arg(JExpr.lit(String.format("GenericUDF.evaluate method failed"))).arg(exVar));

    // get the ValueHolder from retVal and return ObjectInspector
    sub.add(ObjectInspectorHelper.getDrillObject(m, returnOI, workspaceJVars[0], workspaceJVars[4], retVal));
View Full Code Here

    udfInitTry.body().assign(
      workspaceJVars[0],
      workspaceJVars[1].invoke("initialize")
      .arg(oiArray));

    JCatchBlock udfInitCatch = udfInitTry._catch(m.directClass(Exception.class.getCanonicalName()));
    JVar exVar = udfInitCatch.param("ex");
    udfInitCatch.body()
      ._throw(JExpr._new(m.directClass(RuntimeException.class.getCanonicalName()))
        .arg(JExpr.lit(String.format("Failed to initialize GenericUDF"))).arg(exVar));

    sub.add(ObjectInspectorHelper.initReturnValueHolder(g, m, workspaceJVars[4], returnOI, returnType.getMinorType()));
View Full Code Here

    // create try..catch block to call the GenericUDF instance with given input
    JTryBlock udfEvalTry = sub._try();
    udfEvalTry.body().assign(retVal,
      workspaceJVars[1].invoke("evaluate").arg(workspaceJVars[3]));

    JCatchBlock udfEvalCatch = udfEvalTry._catch(m.directClass(Exception.class.getCanonicalName()));
    JVar exVar = udfEvalCatch.param("ex");
    udfEvalCatch.body()
      ._throw(JExpr._new(m.directClass(RuntimeException.class.getCanonicalName()))
        .arg(JExpr.lit(String.format("GenericUDF.evaluate method failed"))).arg(exVar));

    // get the ValueHolder from retVal and return ObjectInspector
    sub.add(ObjectInspectorHelper.getDrillObject(m, returnOI, workspaceJVars[0], workspaceJVars[4], retVal));
View Full Code Here

                                Class targetType = toClass(mapping.getComponentType());
                                JVar valueVar = block.decl(context.toJClass(targetType), propertyName);
                                JTryBlock tryBlock = block._try();
                                tryBlock.body().assign(valueVar, adapterVar.invoke("unmarshal").arg(value));

                                JCatchBlock catchException = tryBlock._catch(context.toJClass(Exception.class));
                                JBlock catchBody = catchException.body();
                                catchBody.invoke(builder.getReadContextVar(), "xmlAdapterError")
                                        .arg(xsrVar)
                                        .arg(context.dotclass(property.getAdapterType()))
                                        .arg(context.dotclass(targetType))
                                        .arg(context.dotclass(targetType))
                                        .arg(catchException.param("e"));
                                catchBody._continue();

                                block.add(new JBlankLine());

                                toSet = valueVar;
View Full Code Here

TOP

Related Classes of com.sun.codemodel.JCatchBlock

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.