Examples of LocalJavaField


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

  private JavaMethod getXMLSerializersMarshalChildsMethod(GroupSG pController, JavaSource pSource) throws SAXException {
    final String mName = "getXMLSerializersMarshalChildsMethod";
    log.finest(mName, "->", pSource.getQName());
    ParticleSG[] myParticles = pController.getParticles();
    JavaMethod jm = null;
    LocalJavaField pElement = null;
    XMLSerializersMarshalChildsSGlet sgLet = null;
    for (int i = 0;  i < myParticles.length;  i++) {
      ParticleSG particle = myParticles[i];
      if (!particle.isElement()) {
        // TODO: Implement handling for wildcards and subgroups
        throw new IllegalStateException("Wildcards and subgroups are not implemented.");
      }
      if (jm == null) {
        jm = pSource.newJavaMethod("marshalChilds", JavaQNameImpl.VOID, JavaSource.PROTECTED);
        DirectAccessible pData = jm.addParam(JavaQNameImpl.getInstance(JMXmlSerializer.Data.class), "pData");
        sgLet = new XMLSerializersMarshalChildsSGlet(pData);
        JavaQName elementInterface = pController.getClassContext().getXMLInterfaceName();
        DirectAccessible pObject = jm.addParam(Object.class, "pObject");
        pElement = jm.newJavaField(elementInterface);
        pElement.addLine("(", elementInterface, ") ", pObject);
        jm.addThrows(SAXException.class);
      }

      sgLet.setChild(particle);
      sgLet.setFieldName(getXMLSerializersFieldName(particle.getPropertySG()));
View Full Code Here

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

    jm.addSwitch("--", pLevelVar);
    jm.addCase("0");
    jm.addBreak();
    jm.addCase("1");
    JavaQName elementInterface = pController.getClassContext().getXMLInterfaceName();
    LocalJavaField element = jm.newJavaField(elementInterface);
    element.addLine("(", elementInterface, ") getResult()");
    jm.addSwitch(pStateVar);
    for (int i = 0;  i < myParticles.length;  i++) {
      ParticleSG child = myParticles[i];
      ObjectSG osg = child.getObjectSG();
      TypeSG childType = osg.getTypeSG();
View Full Code Here

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

    JavaMethod jm = pSource.newJavaMethod("getAttributes", AttributesImpl.class, "protected");
    DirectAccessible pData = jm.addParam(JavaQNameImpl.getInstance(JMXmlSerializer.Data.class), "pData");
    DirectAccessible pElement = jm.addParam(Object.class, "pElement");
    jm.addThrows(SAXException.class);
    LocalJavaField result = jm.newJavaField(AttributesImpl.class);
    result.addLine("super.getAttributes(", pData, ", ", pElement, ")");
    JavaQName elementInterface = pController.getClassContext().getXMLInterfaceName();
    LocalJavaField element = jm.newJavaField(elementInterface);
    element.addLine("(", elementInterface, ") ", pElement);

    AttributeSG[] myAttributes = pController.getAttributes();
    XMLSerializerAttributeSGlet sgLet = new XMLSerializerAttributeSGlet(result, pData);
    for (int i = 0;  i < attributes.length;  i++) {
      AttributeSG attribute = myAttributes[i];
View Full Code Here

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

    jm.addIf(pURI, " == null");
    jm.addLine(pURI, " = \"\";");
    jm.addEndIf();

    JavaQName resultType = pController.getClassContext().getXMLInterfaceName();
    LocalJavaField result = jm.newJavaField(resultType);
    result.addLine("(", resultType, ") getResult()");

    Set uris = new HashSet();
    for (int i = 0;  i < myAttributes.length;  i++) {
      AttributeSG attr = myAttributes[i];
      String uri = attr.getName().getNamespaceURI();
View Full Code Here

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

  }

  public UnionTypeSG getUnionType(SimpleTypeSG pController) { return unionTypeSG; }

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

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

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

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

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

  public Object getCastFromString(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, Object pData) {
    DirectAccessible v;
    if (pValue instanceof DirectAccessible) {
      v = (DirectAccessible) pValue;
    } else {
      LocalJavaField f = pMethod.newJavaField(String.class);
      f.addLine(pValue);
      v = f;
    }
    LocalJavaField f = pMethod.newJavaField(DURATION_TYPE);
    pMethod.addTry();
    pMethod.addLine(f, " = ", DURATION_TYPE, ".valueOf(", pValue, ");");
    pMethod.addCatch(ParseException.class);
    pMethod.addThrowNew(IllegalArgumentException.class, v);
    pMethod.addEndTry();
View Full Code Here

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

  public Object getCastToString(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, DirectAccessible pData) {
    return new Object[]{pValue, ".toString()"};
  }

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

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

    pSGlet.generate(pMethod, pValue);
  }

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

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

    }
  }

  public Object 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
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.