Examples of DirectAccessible


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

    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);
    getValueMethod.addLine("return ", value, ";");

    JavaMethod getNameMethod = js.newJavaMethod("getName", String.class, JavaSource.PUBLIC);
    getNameMethod.addLine("return ", name, ";");

    JavaMethod getInstancesMethod = js.newJavaMethod("getInstances", qNameArray, JavaSource.PUBLIC);
    getInstancesMethod.setStatic(true);
    getInstancesMethod.addLine("return ", instances, ";");

    JavaMethod fromValueMethod = js.newJavaMethod("fromValue", qName, JavaSource.PUBLIC);
    pValue = fromValueMethod.addParam(valueType, "pValue");
    fromValueMethod.setStatic(true);
    DirectAccessible i = fromValueMethod.addForArray(instances);
    fromValueMethod.addIf(pController.getEqualsCheck(fromValueMethod, new Object[]{instances, "[", i, "].value"}, pValue));
    fromValueMethod.addLine("return ", instances, "[", i, "];");
    fromValueMethod.addEndIf();
    fromValueMethod.addEndFor();
    fromValueMethod.addThrowNew(IllegalArgumentException.class, JavaSource.getQuoted("Invalid value: "),
View Full Code Here

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

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

  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

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

  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

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

        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

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

  protected void getFinally(JavaMethod pMethod, DirectAccessible pRessource, Object pSqlMsg,
                              Object pJaxbMsg) {
    pMethod.addLine(pRessource, ".close();");
    pMethod.addLine(pRessource, " = null;");
    if (pSqlMsg != null) {
      DirectAccessible e = pMethod.addCatch(SQLException.class);
      pMethod.addThrowNew(PMException.class, pSqlMsg, " + ", JavaSource.getQuoted(": "),
                          " + ", e, ".getMessage(), ", e);
    }
    if (pJaxbMsg != null) {
      DirectAccessible e = pMethod.addCatch(JAXBException.class);
      pMethod.addIf(e, " instanceof ", PMException.class);
      pMethod.addLine("throw (", PMException.class, ") ", e, ";");
      pMethod.addElse();
      pMethod.addThrowNew(PMException.class, pSqlMsg, " + ", JavaSource.getQuoted(": "),
                          " + ", e, ".getMessage(), ", e);
View Full Code Here

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

                              ".class);");
        } else {
            pMethod.addLine(fieldName + " = new ", serializerClass, "();");
              pMethod.addLine(fieldName + ".init(getFactory());");
        }
          DirectAccessible e = pMethod.addCatch(JAXBException.class);
          pMethod.addThrowNew(SAXException.class, e);
          pMethod.addEndTry();
          pMethod.addEndIf();
          pMethod.addLine(fieldName, ".marshal(", data, ", ", f, ", ", pValue, ");");
      } else {
View Full Code Here

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

  public JavaMethod getXMLSetMethod(SimpleTypeSG pController, JavaSource pSource,
                                     String pFieldName, String pMethodName) throws SAXException {
    if (pController.hasSetMethod()) {
      String pName = "p" + Character.toUpperCase(pFieldName.charAt(0)) + pFieldName.substring(1);
      JavaMethod jm = pSource.newJavaMethod(pMethodName, JavaQNameImpl.VOID, JavaSource.PUBLIC);
      DirectAccessible param = jm.addParam(pController.getRuntimeType(), pName);
      if (!pSource.isInterface()) {
        pController.addValidation(jm, param);
        jm.addLine(pFieldName, " = ", param, ";");
      }
      return jm;
View Full Code Here

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

    throw new LocSAXException("Failed to convert value " + pValue, getLocator(), e);
  }

  public Object getCastFromString(SimpleTypeSG pController, JavaMethod pMethod, Object pValue,
                                   Object pData) throws SAXException {
    DirectAccessible value;
    if (pValue instanceof DirectAccessible) {
      value = (DirectAccessible) pValue;
    } else {
      LocalJavaField v = pMethod.newJavaField(String.class);
      v.addLine(pValue);
View Full Code Here

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

    return result;
  }

  public Object getCastToString(SimpleTypeSG pController, JavaMethod pMethod, Object pValue,
                                 DirectAccessible pData) throws SAXException {
    DirectAccessible value;
    if (pValue instanceof DirectAccessible) {
      value = (DirectAccessible) pValue;
    } else {
      LocalJavaField v = pMethod.newJavaField(Object.class);
      v.addLine(pValue);
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.