Package com.sun.codemodel

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


            JTryBlock tryBlock = block._try();
            tryBlock.body().assign(valueVar, adapterVar.invoke("marshal").arg(propertyVar));

            JCatchBlock catchException = tryBlock._catch(context.toJClass(Exception.class));
            JBlock catchBody = catchException.body();
            catchBody.invoke(builder.getReadContextVar(), "xmlAdapterError")
                    .arg(builder.getWriteObject())
                    .arg(property.getName())
                    .arg(context.dotclass(property.getAdapterType()))
                    .arg(context.dotclass(toClass(property.getType())))  // currently we only support conversion between same type
View Full Code Here


            // add code to constructor which initializes the static dtFactory field
            JTryBlock tryBlock = constructor.body()._try();
            tryBlock.body().assign(datatypeFactory, builderContext.toJClass(DatatypeFactory.class).staticInvoke("newInstance"));

            JCatchBlock catchBlock = tryBlock._catch((builderContext.toJClass(DatatypeConfigurationException.class)));
            catchBlock.body()._throw(JExpr._new(builderContext.toJClass(RuntimeException.class)).arg("Unable to initialize DatatypeFactory").arg(catchBlock.param("e")));
        }

        return datatypeFactory;
    }
View Full Code Here

       
        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

         JVar urlVar = staticBlock.decl(cm.ref(URL.class), "url", JExpr._null());
         JTryBlock tryBlock = staticBlock._try();
         tryBlock.body().assign(urlVar, JExpr._new(cm.ref(URL.class)).arg(JExpr.dotclass(cm.ref(className)).invoke("getResource").arg(".")).arg(wsdlLocation));
         JCatchBlock catchBlock = tryBlock._catch(cm.ref(MalformedURLException.class));
         JVar murlVar = catchBlock.param("murl");
         catchBlock.body().assign(exVar, JExpr._new(cm.ref(WebServiceException.class)).arg(murlVar));
         staticBlock.assign(urlField, urlVar);
         staticBlock.assign(exField, exVar);
     }

    /*
 
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.