Package com.sun.tools.xjc.model

Examples of com.sun.tools.xjc.model.CPropertyInfo


            List<FieldOutline> fields = findAllDeclaredAndInheritedFields(classOutline);
            for(FieldOutline fieldOutline : fields) {
                JType rawType = fieldOutline.getRawType();
                JMethod getter = getter(fieldOutline);
                boolean isJAXBElement = isJAXBElement(getter.type());
                CPropertyInfo propertyInfo = fieldOutline.getPropertyInfo();
                boolean isCollection = propertyInfo.isCollection();
                if (isCollection) {
                    JClass collClazz = (JClass) rawType;
                    JClass collType = collClazz.getTypeParameters().get(0);
                    Traversable t = isTraversable(collType);
                    if (collType.name().startsWith("JAXBElement")) {
View Full Code Here


    }
    return fieldList;
  }

  public static CPropertyInfo searchPropertyInfo(final ClassOutline classOutline, final String name) {
    CPropertyInfo propertyInfo = classOutline.target.getProperty(name);

    if ((propertyInfo == null) && (classOutline.getSuperClass() != null)) {
      propertyInfo = searchPropertyInfo(classOutline.getSuperClass(), name);
    }
View Full Code Here

  // #########################################
  // #########################################
  // #########################################

  public static boolean isFieldMarkedAsRequiredOrMandatoryInXSDSchema(final FieldOutline fo) {
    final CPropertyInfo pi = fo.getPropertyInfo();
    if (pi.getSchemaComponent() instanceof XSParticle) {
      final XSParticle particle = (XSParticle) pi.getSchemaComponent();
      if (particle.getMinOccurs() > 0) {
        // LOG.info("!!! MinOccurs of Element [" + pi.getName(false) + "] is [" + particle.getMinOccurs() + "].");
      }
      return particle.getMinOccurs() > 0;
    } else if (pi.getSchemaComponent() instanceof XSAttributeUse) {
      final XSAttributeUse attributeUse = (XSAttributeUse) pi.getSchemaComponent();
      if (attributeUse.isRequired()) {
        // LOG.info("!!! Required of Attribute [" + pi.getName(false) + "] is [" + attributeUse.isRequired() + "].");
      }
      return attributeUse.isRequired();
    } else {
View Full Code Here

      implClass.javadoc().clear();
      implClass.javadoc().append(kmlJavaDocElement.getJavaDoc());

      for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) {
        if (fieldOutline instanceof FieldOutline) {
          final CPropertyInfo property = fieldOutline.getPropertyInfo();

          final JCodeModel codeModel = classOutline.parent().getCodeModel();

          final JFieldVar currentField = implClass.fields().get(property.getName(false));

          // LOG.info("fieldType: " + currentField.name());
          // find the common type
          final JType currentFieldType = TypeUtil
              .getCommonBaseType(codeModel, listPossibleTypes((ClassOutlineImpl) classOutline, property));
          String currentFieldTypeName = currentFieldType.name().trim().toLowerCase();
          // if found field-type equals object, then there is no need, to document it
          if (currentFieldTypeName.equals("object")) {
            continue;
          }
          currentFieldTypeName = eliminateTypeSuffix(currentFieldTypeName);
          final JaxbJavaDoc javadocForCurrentFieldName = kmlJavaDocElements.get(property.getName(false).trim().toLowerCase());
          if (javadocForCurrentFieldName != null) {
            // LOG.info("++C> " + currentFieldTypeName + " " + property.getName(false));
            currentField.javadoc().clear();
            currentField.javadoc().add(javadocForCurrentFieldName.getJavaDoc());
            continue;
View Full Code Here

   * // changed into: return this.getCollection().add(abstractFeatureGroup);
   * </pre>
   * @param type2
   */
  private void generateAddToCollection(final ClassOutlineImpl cc, final JFieldVar field, final boolean override) {
    final CPropertyInfo propertyInfo = Util.searchPropertyInfo(cc, field.name());
    if (propertyInfo == null) {
      return;
    }

    if (field.name().equals("coordinates") && !override) {
View Full Code Here

      final FieldOutline fieldOutline, final JType cClassInfo, final String shortName) {

    final StringBuffer debugOut = new StringBuffer();

    final String localName = "newValue";
    final CPropertyInfo property = fieldOutline.getPropertyInfo();
    final StringBuffer methodName = new StringBuffer();
    final ArrayList<String> javadoc = new ArrayList<String>();
    methodName.append("createAnd");

    JInvocation methodInvoke = null;
    if (property.isCollection()) {
      methodName.append("Add");
      methodInvoke = JExpr._this().invoke("get" + property.getName(true)).invoke("add").arg(JExpr.ref(localName));
      javadoc.add("and adds it to " + property.getName(false) + ".");
      javadoc.add("\n");
      javadoc.add("This method is a short version for:\n");
      javadoc.add("<code>\n");
      javadoc.add("" + cClassInfo.name() + " " + Util.lowerFirst(cClassInfo.name()) + " = new " + cClassInfo.name() + "();\n");
      javadoc.add("this.get" + property.getName(true) + "().add(" + Util.lowerFirst(cClassInfo.name()) + ");");
      javadoc.add("</code>\n");

    } else {
      methodName.append("Set");
      methodInvoke = JExpr._this().invoke("set" + property.getName(true)).arg(JExpr.ref(localName));
      javadoc.add("and set it to " + property.getName(false) + ".\n");
      javadoc.add("\n");
      javadoc.add("This method is a short version for:\n");
      javadoc.add("<code>\n");
      javadoc.add("" + cClassInfo.name() + " " + Util.lowerFirst(cClassInfo.name()) + " = new " + cClassInfo.name() + "();\n");
      javadoc.add("this.set" + property.getName(true) + "(" + Util.lowerFirst(cClassInfo.name()) + ");");
      javadoc.add("</code>\n");
    }

    // cClassInfo
    final ClassOutlineImpl asClass = classList.get(cClassInfo.fullName());
View Full Code Here

            // FooImpl( T1 a, T2 b, T3 c, ... ) {
            // }
            JMethod c = cc.implClass.constructor(JMod.PUBLIC);

            for( String fieldName : cons.fields ) {
                CPropertyInfo field = cc.target.getProperty(fieldName);
                if(field==null) {
                    outline.getErrorReceiver().error(cc.target.getLocator(),
                        Messages.ILLEGAL_CONSTRUCTOR_PARAM.format(fieldName));
                    continue;
                }
View Full Code Here

        List<CPropertyInfo> props = ci.getProperties();
        Map<QName,CPropertyInfo> collisionTable = new HashMap<QName,CPropertyInfo>();

        OUTER:
        for( int i=0; i<props.size(); i++ ) {
            CPropertyInfo p1 = props.get(i);

            if(p1.getName(true).equals("Class")) {
                errorReceiver.error(p1.locator,Messages.PROPERTY_CLASS_IS_RESERVED.format());
                continue;
            }

            QName n = p1.collectElementNames(collisionTable);
            if(n!=null) {
                CPropertyInfo p2 = collisionTable.get(n);
               
                if (p2.getName(true).equals(n.toString()) || p2.getName(false).equals(n.toString())) {
                    errorReceiver.error(p1.locator, Messages.DUPLICATE_ELEMENT.format(n));
                    errorReceiver.error(p2.locator, Messages.ERR_RELEVANT_LOCATION.format());
                }
            }
View Full Code Here

        simpleTypeBuilder.refererStack.push(ct);
        TypeUse use = simpleTypeBuilder.build(baseType);
        simpleTypeBuilder.refererStack.pop();

        BIProperty prop = BIProperty.getCustomization(ct);
        CPropertyInfo p = prop.createValueProperty("Value",false,baseType,use, BGMBuilder.getName(baseType));
        selector.getCurrentBean().addProperty(p);

        // adds attributes and we are through.
        green.attContainer(ct);
    }
View Full Code Here

        if(decl!=null && decl.getConversion()!=null)
            use = decl.getConversion().getTransducer();
        else
            use = builtinConversions.get(attributeType);

        CPropertyInfo r = new CAttributePropertyInfo(
            propName, null,null/*TODO*/, copyLocator(), qname, use, null, required );

        if(defaultValue!=null)
            r.defaultValue = CDefaultValue.create( use, new XmlString(defaultValue) );

View Full Code Here

TOP

Related Classes of com.sun.tools.xjc.model.CPropertyInfo

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.