Package org.apache.ws.jaxme.js

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


    private DirectAccessible getValue(JavaMethod pMethod, Object pValue, JavaQName pType) {
        if (pValue instanceof DirectAccessible) {
          return (DirectAccessible) pValue;
        } else {
            LocalJavaField s = pMethod.newJavaField(pType);
            s.addLine(pValue);
            return s;
        }
    }
View Full Code Here


    }

    private TypedValue getPrintCall(SimpleTypeSG pController, JavaMethod pMethod,
                                Object pValue, Object pData) {
      JavaQName type = getType(pController);
        LocalJavaField f = pMethod.newJavaField(String.class);
        DirectAccessible value = getValue(pMethod, pValue, type);
        List list = new ArrayList();
        addCall(pController, list, javaType.getPrintMethod(), type);
        addValues(list, value, pData);
        pMethod.addTry();
View Full Code Here

    }
  }

  public TypedValue getCastFromString(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, Object pData)
      throws SAXException {
    LocalJavaField list = pMethod.newJavaField(LIST_TYPE);
    String collectionType = pController.getCollectionType();
    list.addLine("new ", ("indexed".equals(collectionType) ?
                          ARRAYLIST_TYPE : JavaQNameImpl.getInstance(collectionType, true)), "()");
    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();
View Full Code Here

    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, "]"};
View Full Code Here

    pMethod.addEndFor();
    return new TypedValueImpl(new Object[]{sb, ".toString()"}, String.class);
  }

  public void forAllNonNullValues(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, SGlet pSGlet) throws SAXException {
    LocalJavaField f = pMethod.newJavaField(LIST_TYPE);
    f.addLine(pValue);
    pMethod.addIf(f, " != null");
    pSGlet.generate(pMethod, f);
    pMethod.addEndIf();
  }
View Full Code Here

            format = new Object[]{"((", JMUnmarshallerImpl.class, ") ", pData,
                            ".getJMUnmarshaller()).get" + getDatatypeName(), "Format()"};
            mayBeDate = true;
        }
        if (!(pValue instanceof DirectAccessible)) {
            LocalJavaField v = pMethod.newJavaField(String.class);
            v.addLine(pValue);
            pValue = v;
        }
        LocalJavaField pos = pMethod.newJavaField(ParsePosition.class);
        pos.addLine("new ", ParsePosition.class, "(0)");
        LocalJavaField cal = pMethod.newJavaField(mayBeDate ? OBJECT_TYPE : pController.getRuntimeType());
        cal.addLine(format, ".parseObject(", pValue, ", ", pos, ");");
        pMethod.addIf(cal, " == null");
        pMethod.addThrowNew(IllegalArgumentException.class,
                      JavaSource.getQuoted("Failed to parse dateTime "),
                        " + ", pValue, " + ", JavaSource.getQuoted(" at: "),
              " + ", pValue, ".substring(", pos, ".getErrorIndex())");
        pMethod.addEndIf();
        if (mayBeDate) {
            LocalJavaField result = pMethod.newJavaField(pController.getRuntimeType());
            pMethod.addIf(cal, " instanceof ", Calendar.class);
            pMethod.addLine(result, " = (", Calendar.class, ") ", cal, ";");
            pMethod.addElse();
            pMethod.addLine(result, " = ", Calendar.class, ".getInstance();");
            pMethod.addLine(result, ".setTime((", Date.class, ") ", cal, ");");
View Full Code Here

            return cal;
        }
    }

  public void forAllNonNullValues(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, SGlet pSGlet) throws SAXException {
    LocalJavaField f = pMethod.newJavaField(CALENDAR_TYPE);
    f.addLine(pValue);
    pMethod.addIf(f, " != null");
    pSGlet.generate(pMethod, pValue);
    pMethod.addEndIf();
  }
View Full Code Here

  public TypedValue getCastToString(SimpleTypeSG pController, Object pValue, DirectAccessible pData) {
    return new TypedValueImpl(pValue, STRING_TYPE);
  }

  public void forAllNonNullValues(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, SGlet pSGlet) throws SAXException {
    LocalJavaField f = pMethod.newJavaField(STRING_TYPE);
    f.addLine(pValue);
    pMethod.addIf(f, " != null");
    pSGlet.generate(pMethod, pValue);
    pMethod.addEndIf();
  }
View Full Code Here

        } else if (JavaQNameImpl.FLOAT.equals(pType)) {
            return new Object[]{"((", Float.class, ") ", pValue, ").floatValue()"};
        } else if (JavaQNameImpl.DOUBLE.equals(pType)) {
            return new Object[]{"((", Double.class, ") ", pValue, ").doubleValue()"};
        } else if (pType.isArray()) {
            LocalJavaField resultV = pMethod.newJavaField(Vector.class);
            resultV.addLine("(", Vector.class, ") ", pValue, ";");
            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);
View Full Code Here

            return new Object[]{"new ", Float.class, "(", pValue, ")"};
        } else if (pType.equals(JavaQNameImpl.DOUBLE)) {
            return new Object[]{"new ", Double.class, "(", pValue, ")"};
        } else if (pType.isArray()) {
            if (!(pValue instanceof DirectAccessible)) {
              LocalJavaField val = pMethod.newJavaField(pType);
                val.addLine(pValue);
                pValue = val;
            }
            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);
View Full Code Here

TOP

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

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.