Package org.apache.ws.jaxme.js

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


    }
  }

  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


    result.addLine("return ", o, ";");
    return result;
  }

  protected JavaField newStateField() throws SAXException {
    JavaField jf = getJavaSource().newJavaField("__state", boolean.class, JavaSource.PRIVATE);
    JavaComment jc = jf.newComment();
    jc.addLine("Will be set to true, if the first child is parsed.");
    jc.addLine("It is an error, if another child is parsed, and the");
    jc.addLine("fields value is true.");
    return jf;
  }
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

  protected JavaSource getObjectFactory(SchemaSG pController, String pPackageName,
                      List pContextList)
      throws SAXException {
    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

        }
      }
      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) {
            o = pController.getSimpleTypeSG().getCastFromString(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

        JavaQName typeQName = getQName(typeName);
        return pSource.newJavaField(fieldName, typeQName, JavaSource.DEFAULT_PROTECTION);
    }

    private void parseFieldDefinition(JavaSource pSource, AST pAST) {
      JavaField jf = getJavaField(pSource, pAST);
        parseModifiers(jf, pAST);
    }
View Full Code Here

    names.add(itemName);
    names.add(itemValue);
   }

   pSource.addImplements(Serializable.class);
   JavaField name = pSource.newJavaField("name", String.class, JavaSource.PRIVATE);
   name.setFinal(true);
   JavaField value = pSource.newJavaField("value", String.class, JavaSource.PRIVATE);
   name.setFinal(true);
   JavaConstructor jcon = pSource.newJavaConstructor(JavaSource.PRIVATE);
   jcon.addParam(String.class, "pName");
   jcon.addParam(String.class, "pValue");
   jcon.addLine("name = pName;");
   jcon.addLine("value = pValue;");
    List instanceList = new ArrayList();
   for (int i = 0;  i < pItems.length;  i++) {
      Item item = pItems[i];
    String itemName = item.getName();
    String itemValue = item.getValue();
    JavaField instance = pSource.newJavaField(itemName, pSource.getQName(),
                                             JavaSource.PUBLIC);
    instance.newComment().addLine("The enumeration item with name " + itemName +
                                 " and value " + itemValue + ".");
    instance.setStatic(true);
    instance.setFinal(true);
    instance.addLine("new ", pSource.getQName(), "(", JavaSource.getQuoted(itemName),
                     ", ", JavaSource.getQuoted(itemValue), ")");

    if (i > 0) instanceList.add(", ");
     instanceList.add(instance);
    }

   JavaQName arrayType = JavaQNameImpl.getArray(pSource.getQName());
   JavaField allInstances = pSource.newJavaField("allInstances", arrayType,
                                                  JavaSource.PRIVATE);
   allInstances.setStatic(true);
   allInstances.setFinal(true);
   allInstances.addLine("new ", arrayType, "{", instanceList, "}");

   JavaMethod getName = pSource.newJavaMethod("getName", String.class,
                                               JavaSource.PUBLIC);
   getName.newComment().addLine("The enumeration items name.");
   getName.addLine("return ", name, ";");
View Full Code Here

    result.addLine("return ", o, ";");
    return result;
  }

  protected JavaField newStateField() throws SAXException {
    JavaField jf = getJavaSource().newJavaField("__state", boolean.class, JavaSource.PRIVATE);
    JavaComment jc = jf.newComment();
    jc.addLine("Will be set to true, if the first child is parsed.");
    jc.addLine("It is an error, if another child is parsed, and the");
    jc.addLine("fields value is true.");
    return jf;
  }
View Full Code Here

    }
    return result;
  }

  protected JavaField newStateField() throws SAXException {
    JavaField jf = getJavaSource().newJavaField("__state", boolean[].class, JavaSource.PRIVATE);
    jf.addLine("new ", boolean.class, "[" + particles.length + "]");
    JavaComment jc = jf.newComment();
    jc.addLine("This array indicates the state of the group. For any");
    jc.addLine("possible child, the corresponding boolean value is set,");
    jc.addLine("if the child is parsed.");
    jc.addLine("If the same child occurs again, and the childs boolean");
    jc.addLine("value is true, then an exception is thrown.");
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.