Package org.apache.ws.jaxme.js

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


    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);
    getValuesMethod.addLine("return ", values, ";");
   
    {
      JavaMethod jm = jic.newJavaMethod("toString", String.class, JavaSource.PUBLIC);
      LocalJavaField sb = jm.newJavaField(StringBuffer.class, "sb");
      sb.addLine("new ", StringBuffer.class, "(", name, ")");
      DirectAccessible loopVar = jm.addForArray(values);
      jm.addLine(sb, ".append(", JavaSource.getQuoted(", "), ").append(",
          values, "[", loopVar, "]);");
      jm.addEndFor();
      jm.addLine("return ", sb, ".toString();");
     
    }
   
    {
      JavaMethod jm = jic.newJavaMethod("hashCode", int.class, JavaSource.PUBLIC);
      LocalJavaField hashCodeResult = jm.newJavaField(int.class, "result");
      hashCodeResult.addLine(name, ".hashCode() + ", values, ".length;");
      DirectAccessible loopVar = jm.addForArray(values);
      LocalJavaField o = jm.newJavaField(Object.class, "o");
      o.addLine(values, "[", loopVar, "]");
      jm.addIf(o, " != null");
      jm.addLine(hashCodeResult, " += ", o, ".hashCode();");
      jm.addEndIf();
      jm.addEndFor();
      jm.addLine("return ", hashCodeResult, ";");
    }
   
    {
      JavaMethod jm = jic.newJavaMethod("equals", boolean.class, JavaSource.PUBLIC);
      DirectAccessible o = jm.addParam(Object.class, "o");
      jm.addIf(o, " == null  ||  !(", o, " instanceof ", jic.getQName(), ")");
      jm.addLine("return false;");
      jm.addEndIf();
      LocalJavaField other = jm.newJavaField(jic.getQName(), "other");
      other.addLine("(", jic.getQName(), ") ", o);
      jm.addIf("!", name, ".equals(", other, ".name)  ||  ", values, ".length != ",
          other, ".values.length");
      jm.addLine("return false;");
      jm.addEndIf();
      DirectAccessible loopVar = jm.addForArray(values);
      LocalJavaField v = jm.newJavaField(Object.class, "v");
      v.addLine(values, "[", loopVar, "]");
      jm.addIf(v, " == null");
      jm.addIf(other, ".values[", loopVar, "] != null");
      jm.addLine("return false;");
View Full Code Here


  protected JavaMethod getInsertRowMethod(JavaSource pSource, TableInfo pTableInfo) {
    Table table = pTableInfo.getTable();
    JavaMethod jm = pSource.newJavaMethod(getInsertRowMethodName(pTableInfo),
        Object[].class, JavaSource.PRIVATE);
    jm.addThrows(SQLException.class);
    DirectAccessible connection = jm.addParam(Connection.class, "pConn");
    DirectAccessible map = jm.addParam(Map.class, "pMap");
    DirectAccessible values = jm.addParam(Object[].class, "pValue");
   
    logFinestEntering(jm, values);
   
    LocalJavaField baseKey = null;
    if (table.getPrimaryKey() != null) {
View Full Code Here

  protected JavaMethod getInnerInsertRowMethod(JavaSource pSource, TableInfo pTableInfo) {
    Table table = pTableInfo.getTable();
    JavaMethod jm = pSource.newJavaMethod(getInsertRowMethodName(pTableInfo),
        JavaQNameImpl.VOID, JavaSource.PRIVATE);
    jm.addThrows(SQLException.class);
    DirectAccessible connection = jm.addParam(Connection.class, "pConn");
    DirectAccessible values = jm.addParam(Object[].class, "pValue");
   
    logFinestEntering(jm, null);
   
    InsertStatement insertStatement = table.getInsertStatement();
    String s = table.getSchema().getSQLFactory().newSQLGenerator().getQuery(insertStatement);
View Full Code Here

        jc.addLine("All the referencing entries are cloned as well, with updated");
        jc.addLine("references.");
      }
    }
   
    DirectAccessible conn = jm.addParam(Connection.class, "pConn");
    DirectAccessible row = jm.addParam(resultType, "pRow");
   
    logEntering(jm, new Object[]{"new ", Object[].class, "{", conn, ", ", row, "}"});
   
    LocalJavaField map = jm.newJavaField(Map.class, "clonedObjects");
    map.addLine("new ", HashMap.class, "()");
View Full Code Here

            LocalJavaField resultA = pMethod.newJavaField(pType);
            pMethod.addIf(resultV , " == null");
            pMethod.addLine(resultA, " = null;");
            pMethod.addElse();
            pMethod.addLine(resultA, " = new ", pType.getInstanceClass(), "[", resultV, ".size()];");
            DirectAccessible i = pMethod.addForArray(resultA);
            Object element = new Object[]{resultV, ".elementAt(", i, ")"};
            pMethod.addLine(resultA, "[", i, "] = ", getResultValue(pMethod, pType.getInstanceClass(), element), ";");
            pMethod.addEndFor();
            pMethod.addEndIf();
            return resultA;
View Full Code Here

            LocalJavaField v = pMethod.newJavaField(Vector.class);
            pMethod.addIf(pValue, " == null");
            pMethod.addLine(v, " = null;");
            pMethod.addElse();
            pMethod.addLine(v, " = new ", Vector.class, "();");
            DirectAccessible i = pMethod.addForArray(pValue);
            Object element = new Object[]{pValue, "[", i, "]"};
            pMethod.addLine(v, ".add(", getInputValue(pMethod, pType.getInstanceClass(), element), ");");
            pMethod.addEndFor();
            pMethod.addEndIf();
            return v;
View Full Code Here

          jm.addLine("return ", getResultValue(jm, jm.getType(), result), ";");
        }
        if (!exceptionList.isEmpty()) {
            for (int i = 0;  i < exceptionList.size();  i++) {
              JavaQName exClass = (JavaQName) exceptionList.get(i);
                DirectAccessible e = jm.addCatch(exClass);
                jm.addThrowNew(UndeclaredThrowableException.class, e);
            }
            jm.addEndTry();
        }
        return jm;
View Full Code Here

                       JavaSource.getQuoted("Unknown method name: "),
                       " + ", name);
        jm.addEndIf();
        jm.addTry();
        jm.addLine("return ", invoker, ".invoke(", args, ");");
        DirectAccessible e = jm.addCatch(Exception.class);
        jm.addLine("throw ", e, ";");
        DirectAccessible t = jm.addCatch(Throwable.class);
        jm.addThrowNew(UndeclaredThrowableException.class, t);
        jm.addEndTry();
        return jm;
    }
View Full Code Here

      throws SAXException {
    LocalJavaField list = pMethod.newJavaField(LIST_TYPE);
    String collectionType = pController.getCollectionType();
    list.addLine("new ", ("indexed".equals(collectionType) ?
                          ARRAYLIST_TYPE : JavaQNameImpl.getInstance(collectionType)), "()");
    DirectAccessible st = pMethod.addForEnumeration(StringTokenizer.class, new Object[]{"new ", StringTokenizer.class, "(", pValue, ")"});
    pMethod.addLine(list, ".add(", itemType.getSimpleTypeSG().getCastFromString(pMethod, new Object[]{st, ".nextToken()"}, pData),
                    ");");
    pMethod.addEndFor();

    if ("indexed".equals(collectionType)) {
View Full Code Here

  }

  public TypedValue getCastToString(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, DirectAccessible pData)
      throws SAXException {
    String collectionType = pController.getCollectionType();
    DirectAccessible value;
    if (pValue instanceof DirectAccessible) {
      value = (DirectAccessible) pValue;
    } else {
      LocalJavaField v = pMethod.newJavaField(pController.getRuntimeType());
      v.addLine(pValue);
      value = v;
    }

    LocalJavaField sb = pMethod.newJavaField(StringBuffer.class);
    sb.addLine("new ", StringBuffer.class, "()");
    Object v;
    DirectAccessible loopVar;
    if ("indexed".equals(collectionType)) {
      loopVar = pMethod.addForArray(value);
      v = new Object[]{value, "[", loopVar, "]"};
    } else {
      loopVar = pMethod.addForList(value);
View Full Code Here

TOP

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

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.