Package org.apache.ws.jaxme.js

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


     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


        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

  /** <p>Creates a constructor with protected access and a single argument,
   * the backing object.</p>
   */
  protected JavaConstructor getConstructor(JavaSource pJs, InterfaceDescription[] pInterfaces) {
     JavaConstructor jcon = pJs.newJavaConstructor(JavaSource.PROTECTED);
    jcon.addParam(Object.class, "o");
    jcon.addIf("o == null");
    jcon.addThrowNew(NullPointerException.class,
                     JavaSource.getQuoted("The supplied object must not be null."));
    jcon.addEndIf();
    for (int i = 0;  i < pInterfaces.length;  i++) {
      if (pInterfaces[i].isMandatory) {
        jcon.addIf("!(o instanceof ", pInterfaces[i].getInterface(), ")");
        jcon.addThrowNew(ClassCastException.class,
                      JavaSource.getQuoted("The supplied instance of "),
                      " + o.getClass().getName() + ",
                      JavaSource.getQuoted(" is not implementing "),
                      " + ", pInterfaces[i].getInterface(), ".class.getName()");
        jcon.addEndIf();
      }
    }
    jcon.addLine("backingObject = o;");
    return jcon;
  }
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

   pSource.addImplements(Serializable.class);
   JavaField name = pSource.newJavaField("name", String.class, JavaSource.PRIVATE);
   name.setFinal(true);
   JavaField value = pSource.newJavaField("value", String.class, JavaSource.PRIVATE);
   name.setFinal(true);
   JavaConstructor jcon = pSource.newJavaConstructor(JavaSource.PRIVATE);
   jcon.addParam(String.class, "pName");
   jcon.addParam(String.class, "pValue");
   jcon.addLine("name = pName;");
   jcon.addLine("value = pValue;");
    List instanceList = new ArrayList();
   for (int i = 0;  i < pItems.length;  i++) {
      Item item = pItems[i];
    String itemName = item.getName();
    String itemValue = item.getValue();
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

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.