Examples of JavaField


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

      // 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

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

    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

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

    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

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

   * The default implementation generates code creating an instance of
   * {@link org.apache.ws.jaxme.logging.Logger}.</p>
   */
  protected void initLogging(JavaSource pSource) {
    if (isGeneratingLogging()) {
      JavaField jf = pSource.newJavaField("logger", Logger.class, JavaSource.PRIVATE);
      jf.setFinal(true);
      jf.setStatic(true);
      jf.addLine(LoggerAccess.class, ".getLogger(", pSource.getQName(), ".class)");
    }
  }
View Full Code Here

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

  /** <p>Generates the innner class CacheData.</p>
   */
  protected JavaInnerClass getCacheDataClass(JavaSource pSource) {
     JavaInnerClass jic = pSource.newJavaInnerClass("CacheData", JavaSource.PRIVATE);

     JavaField name = jic.newJavaField("name", String.class, JavaSource.PRIVATE);
     name.setFinal(true);
     JavaField values = jic.newJavaField("values", Object[].class, JavaSource.PRIVATE);
     values.setFinal(true);

     JavaConstructor jcon = jic.newJavaConstructor(JavaSource.PRIVATE);
     DirectAccessible pName = jcon.addParam(String.class, "pName");
     DirectAccessible pValues = jcon.addParam(Object[].class, "pValues");
     jcon.addLine(name, " = ", pName, ";");
View Full Code Here

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

    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

Examples of org.eclipse.persistence.jaxb.javamodel.JavaField

                if(element == null) {
                    return null;
                }
            }
        } else {
            JavaField jField = jClass.getDeclaredField(propName);
            if(jField == null) {
                return null;
            }
            pType = jField.getResolvedType();
            element = jField;
        }
       
        return this.aProcessor.buildNewProperty(info, jClass, element, propName, pType);
    }
View Full Code Here

Examples of org.eclipse.persistence.jaxb.javamodel.JavaField

     */
    public JavaField getDeclaredField(String name) {
        Collection<JavaField> allFields = getDeclaredFields();

        for (Iterator<JavaField> iterator = allFields.iterator(); iterator.hasNext();) {
            JavaField field = iterator.next();
            if (field.getName().equals(name)) {
                return field;
            }
        }

        return null;
View Full Code Here

Examples of org.eclipse.persistence.jaxb.javamodel.JavaField

            return properties;
        }

        for (Iterator<JavaField> fieldIt = cls.getDeclaredFields().iterator(); fieldIt.hasNext();) {
          Property property = null;
            JavaField nextField = fieldIt.next();
            int modifiers = nextField.getModifiers();

            if (!Modifier.isTransient(modifiers) && ((Modifier.isPublic(nextField.getModifiers()) && onlyPublic) || !onlyPublic ||hasJAXBAnnotations(nextField))) {
                if (!Modifier.isStatic(modifiers)) {
                    if ((onlyExplicit && hasJAXBAnnotations(nextField)) || !onlyExplicit) {
                         property = buildNewProperty(info, cls, nextField, nextField.getName(), nextField.getResolvedType());
                         properties.add(property);
                    }
                } else {
                    try {
                        property = buildNewProperty(info, cls, nextField, nextField.getName(), nextField.getResolvedType());
                        if (helper.isAnnotationPresent(nextField, XmlAttribute.class)) {
                            Object value = ((JavaFieldImpl) nextField).get(null);
                            if (value != null) {
                                String stringValue = (String) XMLConversionManager.getDefaultXMLManager().convertObject(value, String.class, property.getSchemaType());
                                property.setFixedValue(stringValue);
View Full Code Here

Examples of org.eclipse.persistence.jaxb.javamodel.JavaField

            }
        }
        info.setRestrictionBase(restrictionBase);
    
        for (Iterator<JavaField> fieldIt = javaClass.getDeclaredFields().iterator(); fieldIt.hasNext();) {
            JavaField field = fieldIt.next();
            if (field.isEnumConstant()) {
                Object enumValue = field.getName();
                if (helper.isAnnotationPresent(field, XmlEnumValue.class)) {
                    enumValue = ((XmlEnumValue) helper.getAnnotation(field, XmlEnumValue.class)).value();
                }
                if(restrictionClass != null){
                  try{
                      enumValue = XMLConversionManager.getDefaultXMLManager().convertObject(enumValue, restrictionClass);
                  }catch(ConversionException e){                     
                      throw org.eclipse.persistence.exceptions.JAXBException.invalidEnumValue(enumValue, restrictionClass.getName(), e);
                    }

                }
                info.addJavaFieldToXmlEnumValuePair(field.getName(), enumValue);
            }
        }
        // Add a non-named element declaration for each enumeration to trigger
        // class generation
        if(info.getXmlRootElement() == null) {
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.