Package org.apache.ws.jaxme.js

Examples of org.apache.ws.jaxme.js.JavaMethod.addThrows()


  }
 
  protected JavaMethod getXMLHandlersNewResultMethod(ComplexTypeSG pController, JavaSource pSource) {
    JavaQName elementInterfaceClass = pController.getClassContext().getXMLInterfaceName();
    JavaMethod jm = pSource.newJavaMethod("newResult", elementInterfaceClass, JavaSource.PROTECTED);
    jm.addThrows(SAXException.class);
    if (pController.getClassContext().isGlobal()) {
      jm.addTry();
      jm.addLine("return (", elementInterfaceClass, ") getData().getFactory().getElement(",
          elementInterfaceClass, ".class);");
      DirectAccessible e = jm.addCatch(JAXBException.class);
View Full Code Here


   
    JavaMethod jm = getJavaSource().newJavaMethod("addAttribute", JavaQNameImpl.VOID, JavaSource.PUBLIC);
    DirectAccessible pURI = jm.addParam(String.class, "pURI");
    DirectAccessible pLocalName = jm.addParam(String.class, "pLocalName");
    DirectAccessible pValue = jm.addParam(String.class, "pValue");
    jm.addThrows(SAXException.class);
    jm.addIf(pURI, " == null");
    jm.addLine(pURI, " = \"\";");
    jm.addEndIf();
   
    JavaQName resultType = ctSG.getClassContext().getXMLInterfaceName();
View Full Code Here

    setParamNamespaceURI(pNamespaceURI);
    setParamLocalName(pLocalName);
    setParamQName(pQName);
    setParamAttrs(pAttr);
    setParamResult(null);
    jm.addThrows(SAXException.class);
    return jm;
  }

  public JavaMethod newEndElementMethod() throws SAXException {
    JavaMethod jm = getJavaSource().newJavaMethod("endElement", void.class, JavaSource.PUBLIC);
View Full Code Here

    setParamNamespaceURI(pNamespaceURI);
    setParamLocalName(pLocalName);
    setParamQName(pQName);
    setParamAttrs(null);
    setParamResult(pResult);
    jm.addThrows(SAXException.class);
    return jm;
  }

  public JavaMethod newIsFinishedMethod() throws SAXException {
    JavaMethod jm = getJavaSource().newJavaMethod("isFinished", boolean.class, JavaSource.PUBLIC);
View Full Code Here

    jcon.addLine(jf, " = (", JAXBContextImpl.class, ") ",
                 JAXBContext.class, ".newInstance(",
                 JavaSource.getQuoted(pPackageName), ");");

    JavaMethod newInstanceMethod = js.newJavaMethod("newInstance", Object.class, "public");
    newInstanceMethod.addThrows(JAXBException.class);
    Parameter pElementInterface = newInstanceMethod.addParam(Class.class, "pElementInterface");
    newInstanceMethod.addLine("return ", jf, ".getManager(", pElementInterface, ").getElementJ();");

    {
      JavaMethod getPropertyMethod = js.newJavaMethod("getProperty", Object.class, "public");
View Full Code Here

  if (anonymous) {
    result = pPrefix + result;
  }
    String methodName = "create" + result;
    JavaMethod createMethod = pSource.newJavaMethod(methodName, resultName, "public");
    createMethod.addThrows(JAXBException.class);
  if (anonymous) {
    createMethod.addLine("return new ", pContext.getXMLImplementationName(), "();");
  } else {
    createMethod.addLine("return (", resultName, ") newInstance(", resultName, ".class);");
  }
View Full Code Here

        comment.addLine("This method creates a new instance of the class being");
        comment.addLine("called, converts the parameter objects (if required)");
        comment.addLine("and invokes the requested method. If required, the");
        comment.addLine("result is converted also and returned.");
        jm.addParam(Vector.class, "pParams");
        jm.addThrows(Throwable.class);
        return invoker;
    }

    /** Creates the field with the {@link Map} of invokers.
     */
 
View Full Code Here

        js.addImplements(pInvoker);
        JavaMethod jm = js.newJavaMethod("invoke", Object.class, JavaSource.PUBLIC);
        Parameter param = jm.addParam(Vector.class, "params");
        JavaQName[] classes = pMethod.getExceptions();
        for (int i = 0;  i < classes.length;  i++) {
          jm.addThrows(classes[i]);
        }
        List args = new ArrayList();
        for (int i = 0;  i < params.length;  i++) {
          if (i > 0) {
            args.add(", ");
View Full Code Here

        JavaComment comment = jm.newComment();
        comment.addLine("Called for invocation of method <code>pName</code> with");
        comment.addLine("the parameters given by <code>pParams</code>.");
        Parameter name = jm.addParam(String.class, "pName");
        Parameter args = jm.addParam(Vector.class, "pParams");
        jm.addThrows(Exception.class);
        LocalJavaField invoker = jm.newJavaField(pInvoker);
        invoker.addLine("getInvoker(", name, ")");
        jm.addIf(invoker, " == null");
        jm.addThrowNew(IllegalStateException.class,
                       JavaSource.getQuoted("Unknown method name: "),
View Full Code Here

     JavaSourceFactory factory = new JavaSourceFactory();
     JavaSource js = factory.newJavaSource(JavaQNameImpl.getInstance("com.foo", "Bar"), JavaSource.PUBLIC);
     JavaMethod main = js.newJavaMethod("main", JavaQNameImpl.VOID, JavaSource.PUBLIC);
     main.addParam(String[].class, "pArgs");
     main.setStatic(true);
     main.addThrows(Exception.class);
     main.addFor(int.class, " i = 1;  i < 10;  i++");
     main.newPlaceHolder("test", pAutoMode);
     main.addEndFor();
     js.setDynamicImports(true);
     return js;
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.