Package org.apache.ws.jaxme.js

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


        super("any", pObjectSG.getSchema(), pAny, null, null);
    }

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


  private int fromState(int pState) {
    return pState-1;
  }

  protected JavaField newStateField() throws SAXException {
    JavaField jf = getJavaSource().newJavaField("__state", int.class, JavaSource.PRIVATE);
    JavaComment jc = jf.newComment();
    jc.addLine("The current state. The following values are valid states:");
    jc.addLine(" 0 = Before parsing the element");
    for (int i = 0;  i < particles.length;  i++) {
      ParticleSG particle = particles[i];
      if (particle.isGroup()) {
View Full Code Here

    ComplexTypeSG complexTypeSG = myTypeSG.getComplexTypeSG();
    if (myTypeSG.isGlobalClass()) {
      js.addExtends(complexTypeSG.getClassContext().getXMLImplementationName());
    }

    JavaField myName = js.newJavaField("__qName", QName.class, JavaSource.PRIVATE);
    myName.setStatic(true);
    myName.setFinal(true);
    XsQName qName = pController.getName();
    String prefix = qName.getPrefix();
    if (prefix == null) {
      myName.addLine("new ", QName.class, "(", JavaSource.getQuoted(qName.getNamespaceURI()),
                     ", ", JavaSource.getQuoted(qName.getLocalName()), ")");
    } else {
        myName.addLine("new ", QName.class, "(", JavaSource.getQuoted(qName.getNamespaceURI()),
                     ", ", JavaSource.getQuoted(qName.getLocalName()), ", ",
             JavaSource.getQuoted(prefix), ")");
    }

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

    }
  }

  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

    JavaQName qNameArray = JavaQNameImpl.getArray(qName);

    JavaSource js = pController.getSchema().getJavaSourceFactory().newJavaSource(qName, JavaSource.PUBLIC);
    js.addImplements(Serializable.class);

    JavaField name = js.newJavaField("name", String.class, JavaSource.PRIVATE);
    name.setFinal(true);
    JavaField value = js.newJavaField("value", valueType, JavaSource.PRIVATE);
    value.setFinal(true);
    JavaField lexicalValue = js.newJavaField("lexicalValue", String.class, JavaSource.PRIVATE);
    lexicalValue.setFinal(true);

    List instanceParams = new ArrayList();
    for (int i = 0;  i < values.length;  i++) {
      JavaField _f = js.newJavaField("_" + values[i].getName(), String.class, JavaSource.PUBLIC);
      _f.setStatic(true);
      _f.setFinal(true);
      _f.addLine(JavaSource.getQuoted(values[i].getName()));

      JavaField f = js.newJavaField(values[i].getName(), qName, JavaSource.PUBLIC);
      f.addLine("new ", qName, "(", JavaSource.getQuoted(values[i].getName()), ", ",
                super.getCastFromString(pController, values[i].getValue()), ", ",
                JavaSource.getQuoted(values[i].getValue()), ");");
      f.setStatic(true);
      f.setFinal(true);
      if (!instanceParams.isEmpty()) instanceParams.add(", ");
      instanceParams.add(f);
    }
    JavaField instances = js.newJavaField("instances", qNameArray, JavaSource.PRIVATE);
    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");
View Full Code Here

            if (xjcSerializable != null) {
                if (!pSource.isImplementing(SERIALIZABLE_TYPE)) {
                    pSource.addImplements(SERIALIZABLE_TYPE);
                }
                if (xjcSerializable.getUid() != null) {
                    JavaField uid = pSource.newJavaField("serialVersionUID", JavaQNameImpl.LONG, JavaSource.PRIVATE);
                    uid.setStatic(true);
                    uid.setFinal(true);
                    uid.addLine(xjcSerializable.getUid());
                }
            }
        }
    }
View Full Code Here

        }
      }
      else {
        runtimeType = pController.getRuntimeType();
      }
      JavaField jf = pSource.newJavaField(pFieldName, runtimeType, JavaSource.PRIVATE);
      if (!pController.isComplex()) {
        Object o = pController.getSimpleTypeSG().getInitialValue(pSource);
        if (o == null && pDefaultValue != null) {
          if (runtimeType.equals(StringSG.STRING_TYPE)) {
            o = "\"" + pDefaultValue + "\"";
          }
          else {
            o = pDefaultValue;
          }
        }
        if (o != null) {
          jf.addLine(o);
        }
      }
      return jf;
    }
  }
View Full Code Here

                                    String pFieldName, String pMethodName)
      throws SAXException {
    JavaMethod jm = pSource.newJavaMethod(pMethodName, BooleanSG.BOOLEAN_TYPE, JavaSource.PUBLIC);
    if (!pSource.isInterface()) {
      if (pController.getRuntimeType().isPrimitive()) {
        JavaField jf = pSource.newJavaField(getIsSetCheckFieldName(pFieldName), BooleanSG.BOOLEAN_TYPE);
        jm.addLine("return ", jf, ";");
      } else {
        jm.addLine("return (" + pFieldName + " != null);");
      }
    }
View Full Code Here

  public JavaField getXMLField(PropertySG pController, JavaSource pSource) throws SAXException {
    if (pSource.isInterface()) {
      return null;
    }
    JavaQName runtimeType = JavaQNameImpl.getInstance(Map.class);
    JavaField jf = pSource.newJavaField(pController.getXMLFieldName(), runtimeType, JavaSource.PRIVATE);
    jf.setFinal(true);
    jf.addLine("new ", HashMap.class, "()");
    return jf;
  }
View Full Code Here

  protected JavaField getNamespaces(PropertySG pController, JavaSource pSource) throws SAXException {
      if (namespaceList.isAny()  ||  namespaceList.isOther()) {
          return null;
      }
      String namespaces = pController.getXMLFieldName() + "Namespaces";
      JavaField jf = pSource.newJavaField(namespaces, Set.class);
      jf.setStatic(true);
      jf.setFinal(true);
      JavaClassInitializer jci = pSource.newJavaClassInitializer();
      LocalJavaField set = jci.newJavaField(Set.class);
      set.addLine("new ", HashSet.class, "()");
      XsAnyURI[] uris = namespaceList.getUris();
      for (int i = 0;  i < uris.length;  i++) {
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.