Examples of DirectAccessible


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

      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();

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

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

  }

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

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

      jc.addLine("<p>Returns the array of 'anyAttributes'.</p>");
      LocalJavaField size = jm.newJavaField(int.class);
      size.addLine(pController.getXMLFieldName(), ".size()");
      LocalJavaField result = jm.newJavaField(jm.getType());
      result.addLine("new ", WildcardAttribute.class, "[", size, "]");
      DirectAccessible iter = jm.addForCollection(new Object[]{pController.getXMLFieldName(), ".entrySet()"});
      LocalJavaField entry = jm.newJavaField(Map.Entry.class);
      entry.addLine("(", Map.Entry.class, ") ", iter, ".next()");
      if (!pSource.isInterface()) {
        jm.addLine(result, "[--", size, "] = new ", WildcardAttribute.class, "((",
                   QName.class, ") ", entry, ".getKey(), (", String.class, ") ",
View Full Code Here

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

  }

  private JavaMethod getXMLSerializersInitMethod(GroupSG pController, JavaSource pSource) throws SAXException {
    ParticleSG[] myParticles = pController.getParticles();
    JavaMethod jm = null;
    DirectAccessible pFactory = null;
    for (int i = 0;  i < myParticles.length;  i++) {
      ParticleSG particle = myParticles[i];
      if (!particle.isElement()) {
        continue;
      }
View Full Code Here

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

    XMLSerializersMarshalChildsSGlet sgLet = null;
    for (int i = 0;  i < myParticles.length;  i++) {
      ParticleSG particle = myParticles[i];
      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);
      }
View Full Code Here

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

  }
   

  private JavaMethod getXMLHandlersInitMethod(GroupSG pController, JavaSource pSource) throws SAXException {
    JavaMethod jm = null;
    DirectAccessible pData = null;
    ParticleSG[] myParticles = pController.getParticles();
    for (int i = 0;  i < myParticles.length;  i++) {
      ParticleSG particle = myParticles[i];
      if (particle.isElement()) {
        ObjectSG objectSG = particle.getObjectSG();
        TypeSG typeSG = objectSG.getTypeSG();
        if (typeSG.isComplex()) {
          if (jm == null) {
            jm = pSource.newJavaMethod("init", JavaQNameImpl.VOID, JavaSource.PUBLIC);
            pData = jm.addParam(JMHandler.Data.class, "pData");
            jm.addThrows(JAXBException.class);
            jm.addLine("super.init(", pData, ");");
          }

          String f = particle.getPropertySG().getXMLFieldName();
          String handlerFieldName = "__handler_" + f;
          String handlerMethodName = getXMLHandlersMethodName(particle.getPropertySG());

          JavaField jf = pSource.newJavaField(handlerFieldName, JMHandler.class, JavaSource.PRIVATE);
          JavaMethod jm2 = pSource.newJavaMethod(handlerMethodName, JMHandler.class, "protected");
          jm2.addThrows(SAXException.class);
          jm2.addIf(handlerFieldName, " == null");
         
          ComplexTypeSG childSG = typeSG.getComplexTypeSG();
          JavaQName handlerClassName = childSG.getClassContext().getXMLHandlerName();
          jm2.addTry();
          if (typeSG.isGlobalClass()) {
            JavaQName interfaceName;
            if (objectSG.isGlobal()) {
                interfaceName = objectSG.getClassContext().getXMLInterfaceName();
            } else {
              interfaceName = childSG.getClassContext().getXMLInterfaceName();
            }
            jm2.addLine(handlerFieldName, " = getData().getFactory().getJMHandler(",
                        interfaceName, ".class);");
          } else {
            jm2.addLine(jf, " = new ", handlerClassName, "();");
          }
          jm2.addLine(jf, ".init(getData());");
          DirectAccessible e = jm2.addCatch(JAXBException.class);
          jm2.addThrowNew(SAXException.class, e);
          jm2.addEndTry();
          jm2.addEndIf();
          jm2.addLine("return ", jf, ";");
View Full Code Here

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

    if (myParticles.length == 0) {
      return null;
    }

    JavaMethod jm = pSource.newJavaMethod("endElement", JavaQNameImpl.VOID, JavaSource.PUBLIC);
    DirectAccessible pNamespaceURI = jm.addParam(String.class, "pNamespaceURI");
    DirectAccessible pLocalName = jm.addParam(String.class, "pLocalName");
    DirectAccessible pQName = jm.addParam(String.class, "pQName");
    jm.addThrows(SAXException.class);

    jm.addIf(pHandlerVar, " == null");
    jm.addIf(pLevelVar, " > 1");
    jm.addLine("super.endElement(", pNamespaceURI, ", ", pLocalName, ", ", pQName, ");");
View Full Code Here

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

  public JavaMethod getXMLHandlersCharactersMethod(GroupSG pController, JavaSource pSource,
                                                    DirectAccessible pHandlerVar)
      throws SAXException {
    JavaMethod jm = pSource.newJavaMethod("characters", JavaQNameImpl.VOID, JavaSource.PUBLIC);
    DirectAccessible pChars = jm.addParam(char[].class, "pChars");
    DirectAccessible pOffset = jm.addParam(int.class, "pOffset");
    DirectAccessible pLen = jm.addParam(int.class, "pLen");
    jm.addThrows(SAXException.class);
    jm.addIf(pHandlerVar, " == null");
    jm.addLine("super.characters(", pChars,", ", pOffset, ", ", pLen, ");");
    jm.addElse();
    jm.addLine(pHandlerVar, ".characters(", pChars, ", ", pOffset, ", ", pLen, ");");
View Full Code Here

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

          }
        }
        else {
          runtimeType = pController.getRuntimeType();
        }
      DirectAccessible param = jm.addParam(runtimeType, pName);
      if (!pSource.isInterface()) {
        jm.addLine(pFieldName, " = ", param, ";");
      }
      return jm;
    } else {
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
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.