Package org.apache.ws.jaxme.js

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


  }

  private JavaField getXMLHandlersHandlerField(GroupSG pController, JavaSource pSource) throws SAXException {
    ParticleSG[] myParticles = pController.getParticles();
    if (myParticles.length > 0) {
      JavaField jf = pSource.newJavaField("__handler", JMHandler.class, JavaSource.PRIVATE);
      jf.newComment().addLine("The current handler for parsing child elements or simple content.");
      return jf;
    }
    return null;

  }
View Full Code Here


    return jm;
  }

  public void generateXMLHandlersElements(GroupSG pController, JavaSource pSource, DirectAccessible pLevelVar)
      throws SAXException {
    JavaField stateVar = getXMLHandlersStateField(pController, pSource);
    JavaField handlerVar = getXMLHandlersHandlerField(pController, pSource);
    extendXMLHandlersStartDocumentMethod(pController, pSource, stateVar, handlerVar);
    extendXMLHandlersStartElementMethod(pController, pSource, stateVar, handlerVar);
    getXMLHandlersEndElementMethod(pController, pSource, pLevelVar, stateVar, handlerVar);
    getXMLHandlersCharactersMethod(pController, pSource, handlerVar);
    getXMLHandlersElements(pController, pSource);
View Full Code Here

      fieldName = pFieldName;
    }
    public boolean isCasting() { return !child.getObjectSG().getTypeSG().isComplex(); }
    public void generate(JavaMethod pMethod, Object pValue) throws SAXException {
      ObjectSG objectSG = child.getObjectSG();
      JavaField f = pMethod.getJavaSource().newJavaField(fieldName + "_qname", QName.class);
      f.setStatic(true);
      f.setFinal(true);
      f.addLine("new ", QName.class, "(", JavaSource.getQuoted(objectSG.getName().getNamespaceURI()),
                ", ", JavaSource.getQuoted(objectSG.getName().getLocalName()), ");");
      if (objectSG.getTypeSG().isComplex()) {
        pMethod.addLine(fieldName, ".marshal(", data, ", ", f, ", ", pValue, ");");
      } else {
        Object v = child.getObjectSG().getTypeSG().getSimpleTypeSG().getCastToString(pMethod, pValue, data);
View Full Code Here

  public JavaField getXMLField(TypeSG pController, JavaSource pSource, String pFieldName) throws SAXException {
    if (pSource.isInterface()) {
      return null;
    } else {
      JavaField jf = pSource.newJavaField(pFieldName, pController.getRuntimeType(), JavaSource.PRIVATE);
      if (!pController.isComplex()) {
        Object o = pController.getSimpleTypeSG().getInitialValue(pSource);
        if (o != null) {
          jf.addLine(o);
        }
      }
      return jf;
    }
  }
View Full Code Here

  }

  protected JavaSource getObjectFactory(SchemaSG pController, String pPackageName, List pContextList) {
    JavaQName qName = JavaQNameImpl.getInstance(pPackageName, "ObjectFactory");
    JavaSource js = pController.getJavaSourceFactory().newJavaSource(qName, "public");
    JavaField jf = js.newJavaField("jaxbContext", JAXBContextImpl.class, "private");
    JavaField properties = js.newJavaField("properties", Map.class, "private");

    JavaConstructor jcon = js.newJavaConstructor("public");
    jcon.addThrows(JAXBException.class);
    jcon.addLine(jf, " = (", JAXBContextImpl.class, ") ",
                 JAXBContext.class, ".newInstance(",
View Full Code Here

    return jm;
  }

  private JavaField getXMLHandlersLevelField(ComplexTypeSG pController, JavaSource pSource) {
    JavaField jf = pSource.newJavaField("__level", int.class, JavaSource.PRIVATE);
    jf.newComment().addLine("The current level of nested elements. 0, if outside the root element.");
    return jf;
  }
View Full Code Here

    jf.newComment().addLine("The current level of nested elements. 0, if outside the root element.");
    return jf;
  }

  public void generateXMLHandlerMethods(ComplexTypeSG pController, JavaSource pSource) throws SAXException {
    JavaField levelVar = getXMLHandlersLevelField(pController, pSource);
    getXMLHandlersStartDocumentMethod(pController, pSource, levelVar);
    getXMLHandlersAddAttributeMethod(pController, pSource);
    getXMLHandlersNewResultMethod(pController, pSource);
    getXMLHandlersStartElementMethod(pController, pSource, levelVar);
    if (pController.hasSimpleContent()) {
View Full Code Here

      while (js.isInnerClass()) {
        js = ((JavaInnerClass) js).getOuterClass();
      }
      JavaField[] fields = js.getFields();
      JavaQName qName = JavaQNameImpl.getInstance(DatatypeConverterInterface.class);
      JavaField converter = null;
      for (int i = 0;  i < fields.length;  i++) {
        if (qName.equals(fields[i].getType())  &&  JavaSource.DEFAULT_PROTECTION.equals(fields[i].getProtection())  &&
            fields[i].isStatic()  &&  fields[i].isFinal()) {
          converter = fields[i];
          break;
        }
      }
      if (converter == null) {
        converter = js.newJavaField("__dataTypeConverter", qName);
        converter.setStatic(true);
        converter.setFinal(true);
        converter.addLine("new ", DatatypeConverterImpl.class, "()");
      }
      return new Object[]{converter, ".parse" + getDatatypeName() + "(", pValue, ")"};
    } else {
      return new Object[]{pData, ".getDatatypeConverter().parse" + getDatatypeName() + "(", pValue, ")"};
    }
View Full Code Here

      // No need to generate the types XML implementation; this is done by the schema.
    } else {
      complexTypeSG.generateXMLImplementationMethods(js);
    }

    JavaField myName = js.newJavaField("__qName", QName.class, JavaSource.PRIVATE);
    myName.setStatic(true);
    myName.setFinal(true);
    XsQName qName = pController.getName();
    myName.addLine("new ", QName.class, "(", JavaSource.getQuoted(qName.getNamespaceURI()),
                   ", ", JavaSource.getQuoted(qName.getLocalName()), ")");

    JavaMethod getQName = js.newJavaMethod("getQName", QName.class, JavaSource.PUBLIC);
    getQName.addLine("return ", myName, ";");
View Full Code Here

    return maxOccurs == -||  maxOccurs > 1;
  }

  public JavaField getXMLField(PropertySG pController, JavaSource pSource) throws SAXException {
    String fieldName = pController.getXMLFieldName();
    JavaField result = pSource.newJavaField(fieldName, List.class, JavaSource.PRIVATE);
    result.addLine("new ", ArrayList.class, "()");
    return result;
  }
View Full Code Here

TOP

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

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.