Package org.apache.ws.jaxme.js

Examples of org.apache.ws.jaxme.js.JavaConstructor


    JavaQName qName = JavaQNameImpl.getInstance(pPackageName, "ObjectFactory");
    JavaSource js = pController.getJavaSourceFactory().newJavaSource(qName, "public");
    JavaField jf = js.newJavaField("jaxbContext", JAXBContextImpl.class, "private");
    JavaField properties = js.newJavaField("properties", Map.class, "private");

    JavaConstructor jcon = js.newJavaConstructor("public");
    jcon.addThrows(JAXBException.class);
    jcon.addLine(jf, " = (", JAXBContextImpl.class, ") ",
                 JAXBContext.class, ".newInstance(",
                 JavaSource.getQuoted(pPackageName), ");");

    JavaMethod newInstanceMethod = js.newJavaMethod("newInstance", Object.class, "public");
    newInstanceMethod.addThrows(JAXBException.class);
View Full Code Here


        jf.setFinal(true);
        return jf;
    }

    protected JavaConstructor getConstructor(JavaSource pJs, JavaField jf) {
        JavaConstructor jcon = pJs.newJavaConstructor(JavaSource.PUBLIC);
        Parameter param = jcon.addParam(XmlRpcCaller.class, "pCaller");
        jcon.addLine(jf, " = ", param, ";");
        return jcon;
    }
View Full Code Here

    /** Creates the dispatchers constructor.
     */
    public JavaConstructor getDispatcherConstructor(JavaSource pSource,
                                                    JavaField pMap,
                                                    JavaQName pInvoker) {
        JavaConstructor con = pSource.newJavaConstructor(JavaSource.PUBLIC);
        JavaComment comment = con.newComment();
        comment.addLine("Creates a new dispatcher.");
        int num = 0;
        for (Iterator iter = methods.entrySet().iterator();  iter.hasNext()) {
            Map.Entry entry = (Map.Entry) iter.next();
            String name = (String) entry.getKey();
            JavaMethod method = (JavaMethod) entry.getValue();
            JavaSource innerClass = getInvoker(pSource, method, pInvoker, num++);
            con.addLine(pMap, ".put(", JavaSource.getQuoted(name), ", new ", innerClass.getQName(), "());");
        }
        return con;
    }
View Full Code Here

    JavaField name = jic.newJavaField("name", String.class, JavaSource.PRIVATE);
    name.setFinal(true);
    JavaField values = jic.newJavaField("values", Object[].class, JavaSource.PRIVATE);
    values.setFinal(true);
   
    JavaConstructor jcon = jic.newJavaConstructor(JavaSource.PRIVATE);
    DirectAccessible pName = jcon.addParam(String.class, "pName");
    DirectAccessible pValues = jcon.addParam(Object[].class, "pValues");
    jcon.addLine(name, " = ", pName, ";");
    jcon.addLine(values, " = ", pValues, ";");
   
    JavaMethod getNameMethod = jic.newJavaMethod("getName", String.class, JavaSource.PUBLIC);
    getNameMethod.addLine("return ", name, ";");
   
    JavaMethod getValuesMethod = jic.newJavaMethod("getValues", Object[].class, JavaSource.PUBLIC);
View Full Code Here

  }

   public JavaSource getSource(JavaSource.Protection pProtection) {
      JavaSourceFactory factory = new JavaSourceFactory();
      JavaSource js;
      JavaConstructor jcon;
      JavaMethod jm;
      JavaField jf;
      LocalJavaField lfj;
      if (pProtection == null) {
        js = factory.newJavaSource(JavaQNameImpl.getInstance(PACKAGE_NAME, CLASS_NAME));
        js.newJavaInnerClass("Bof");
        jf = js.newJavaField("someField", int.class);
        jcon = js.newJavaConstructor();
        jm = js.newJavaMethod("test", void.class);
        lfj = jm.newJavaField(String.class, "localTest");
      } else {
        js = factory.newJavaSource(JavaQNameImpl.getInstance(PACKAGE_NAME, CLASS_NAME), pProtection);
        js.newJavaInnerClass("Bof", pProtection);
        jf = js.newJavaField("someField", int.class, pProtection);
        jcon = js.newJavaConstructor(pProtection);
        jm = js.newJavaMethod("test", void.class, pProtection);
        lfj = jm.newJavaField(String.class, "localTest");
      }
      lfj.setFinal(true);
      lfj.addLine(JavaSource.getQuoted("abc"));

      jcon.addLine(jf, " = 0;");
      jm.addThrowNew(NullPointerException.class, JavaSource.getQuoted("Not implemented"));
      return js;
   }
View Full Code Here

    JavaField instances = js.newJavaField("instances", qNameArray, JavaSource.PRIVATE);
    instances.addLine(new Object[]{"new ", qNameArray, "{", instanceParams, "}"});
    instances.setStatic(true);
    instances.setFinal(true);

    JavaConstructor con = js.newJavaConstructor(JavaSource.PRIVATE);
    DirectAccessible pName = con.addParam(String.class, "pName");
    DirectAccessible pValue = con.addParam(super.getRuntimeType(pController), "pValue");
    DirectAccessible pLexicalValue = con.addParam(String.class, "pLexicalValue");
    con.addLine(name, " = ", pName, ";");
    con.addLine(value, " = ", pValue, ";");
    con.addLine(lexicalValue, " = ", pLexicalValue, ";");

    JavaMethod toStringMethod = js.newJavaMethod("toString", String.class, JavaSource.PUBLIC);
    toStringMethod.addLine("return ", lexicalValue, ";");

    JavaMethod getValueMethod = js.newJavaMethod("getValue", valueType, JavaSource.PUBLIC);
View Full Code Here

    JavaQName qName = JavaQNameImpl.getInstance(pPackageName, "ObjectFactory");
    JavaSource js = pController.getJavaSourceFactory().newJavaSource(qName, "public");
    JavaField jf = js.newJavaField("jaxbContext", JAXBContextImpl.class, "private");
    JavaField properties = js.newJavaField("properties", Map.class, "private");

    JavaConstructor jcon = js.newJavaConstructor("public");
    jcon.addThrows(JAXBException.class);
    jcon.addLine(jf, " = (", JAXBContextImpl.class, ") ",
                 JAXBContext.class, ".newInstance(",
                 JavaSource.getQuoted(pPackageName), ");");

    JavaMethod newInstanceMethod = js.newJavaMethod("newInstance", Object.class, "public");
    newInstanceMethod.addThrows(JAXBException.class);
View Full Code Here

     protected JavaField getBackingObjectField(JavaSource pJs, InterfaceDescription[] pInterfaces) {
       return pJs.newJavaField("backingObject", getChainInterface(), JavaSource.PRIVATE);
     }
     protected JavaConstructor getConstructor(JavaSource pJs,
                       InterfaceDescription[] pInterfaces) {
       JavaConstructor jcon = pJs.newJavaConstructor(JavaSource.PROTECTED);
       jcon.addParam(getChainInterface(), "o");
       jcon.addIf("o == null");
       jcon.addThrowNew(NullPointerException.class,
           JavaSource.getQuoted("The supplied object must not be null."));
       jcon.addEndIf();
       jcon.addLine("backingObject = o;");
       return jcon;
     }
View Full Code Here

        parseParameters(jm, pAST);
        parseExceptions(jm, pAST);
    }

    private void parseConstructorDefinition(JavaSource pSource, AST pAST) {
      JavaConstructor jc = pSource.newJavaConstructor(JavaSource.DEFAULT_PROTECTION);
        parseModifiers(jc, pAST);
        parseParameters(jc, pAST);
        parseExceptions(jc, pAST);
    }
View Full Code Here

     protected JavaField getBackingObjectField(JavaSource pJs, InterfaceDescription[] pInterfaces) {
       return pJs.newJavaField("backingObject", getChainInterface(), JavaSource.PRIVATE);
     }
     protected JavaConstructor getConstructor(JavaSource pJs,
                       InterfaceDescription[] pInterfaces) {
       JavaConstructor jcon = pJs.newJavaConstructor(JavaSource.PUBLIC);
       jcon.addParam(getChainInterface(), "o");
       jcon.addIf("o == null");
       jcon.addThrowNew(NullPointerException.class,
           JavaSource.getQuoted("The supplied object must not be null."));
       jcon.addEndIf();
       jcon.addLine("backingObject = o;");
       return jcon;
     }
View Full Code Here

TOP

Related Classes of org.apache.ws.jaxme.js.JavaConstructor

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.