private void processFieldsForChildren()

in modules/compiler/src/java/flex2/compiler/asdoc/TopLevelClassesGenerator.java [2626:2919]


    private void processFieldsForChildren(Node parent)
    {
        // Go deep and process excludes..
        NodeList listOfChilds = parent.getChildNodes();
        if (listOfChilds != null && listOfChilds.getLength() != 0)
        {
            for (int ix = 0; ix < listOfChilds.getLength(); ix++)
            {
                Node childNode = listOfChilds.item(ix);
                if (childNode.getNodeType() != Node.ELEMENT_NODE)
                {
                    continue;
                }
                Element child = (Element)childNode;

                processFieldsForChildren(child);
            }
        }

        if (parent.getNodeName().equals("field"))
        {
            String name = ((Element)parent).getAttribute("name");
            String fullName = ((Element)parent).getAttribute("fullname");
            if (verbose)
            {
                System.out.println("   processing field: " + fullName);
            }

            // skip fields tagged with @private, even if they are public
            NodeList children = ((Element)parent).getElementsByTagName("private");
            if (((children != null && children.getLength() != 0) || ((Element)parent).getAttribute("access").equals("private")) && !includePrivate)
            {
                return;
            }

            QualifiedNameInfo qualifiedFullName = decomposeFullMethodOrFieldName(fullName);

            // skip fields actually in the private namespace
            if (asDocUtil.hideNamespace(qualifiedFullName.getMethodNameSpace(), namespaces) || asDocUtil.hidePackage(qualifiedFullName.getPackageName(), hiddenPackages))
            {
                return;
            }

            AsClass myClass = classTable.get(qualifiedFullName.getFullClassName());
            if (myClass == null)
            {
                // not an error, likely a method or field for a private class
                return;
            }

            Element prolog = asDocUtil.getElementByTagName(myClass.getNode(), "prolog");
            if (prolog != null)
            {
                Element asMetadata = asDocUtil.getElementByTagName(prolog, "asMetadata");
                if (asMetadata != null)
                {
                    NodeList excludeList = asMetadata.getElementsByTagName("Exclude");
                    if (excludeList != null && excludeList.getLength() != 0)
                    {
                        for (int ix = 0; ix < excludeList.getLength(); ix++)
                        {
                            Element exclude = (Element)excludeList.item(ix);
                            if (exclude.getAttribute("kind").equals("property"))
                            {
                                if (exclude.getAttribute("name").equals(name))
                                {
                                    if (verbose)
                                    {
                                        System.out.println("Excluding property " + name + " from " + myClass.getName());
                                    }

                                    return;
                                }
                            }
                        }
                    }
                }
            }

            String isConst = ((Element)parent).getAttribute("isConst");

            if (isConst.equals(""))
            {
                isConst = "false";
            }

            Element apiValue = outputObject.createElement("apiValue");
            apiValue.setAttribute("id", asDocUtil.formatId(fullName));

            Element apiName = outputObject.createElement("apiName");
            apiName.setTextContent(name);

            apiValue.appendChild(apiName);
            Element shortdesc = outputObject.createElement("shortdesc");
            apiValue.appendChild(shortdesc);
            prolog = outputObject.createElement("prolog");
            apiValue.appendChild(prolog);

            Element apiValueDetail = outputObject.createElement("apiValueDetail");
            Element apiValueDef = outputObject.createElement("apiValueDef");
            apiValueDetail.appendChild(apiValueDef);

            apiValue.appendChild(apiValueDetail);

            if (isConst.equals("false"))
            {
                Element apiProperty = outputObject.createElement("apiProperty");
                apiValueDef.appendChild(apiProperty);
            }

            children = ((Element)parent).getElementsByTagName("author");
            if (children != null && children.getLength() != 0)
            {
                String author = children.item(0).getTextContent();
                if (!author.equals(""))
                {
                    Element authorElement = outputObject.createElement("author");
                    authorElement.setTextContent(author);
                    prolog.appendChild(authorElement);
                }
            }

            Element apiAccess = outputObject.createElement("apiAccess");
            apiAccess.setAttribute("value", qualifiedFullName.getMethodNameSpace());
            apiValueDef.appendChild(apiAccess);

            if (((Element)parent).getAttribute("isStatic").equals("true"))
            {
                Element apiStatic = outputObject.createElement("apiStatic");
                apiValueDef.appendChild(apiStatic);
            }
            else
            {
                Element apiDynamic = outputObject.createElement("apiDynamic");
                apiValueDef.appendChild(apiDynamic);
            }

            String defaultValue = ((Element)parent).getAttribute("defaultValue");
            if (defaultValue.length() > 0)
            {
                Element apiData = outputObject.createElement("apiData");
                apiData.setTextContent(defaultValue);
                apiValueDef.appendChild(apiData);
            }

            String type = ((Element)parent).getAttribute("type");

            AsClass fieldClass = classTable.get(type);
            if (fieldClass != null)
            {
                Element apiValueClassifier = outputObject.createElement("apiValueClassifier");
                apiValueClassifier.setTextContent(fieldClass.getFullName());
                apiValueDef.appendChild(apiValueClassifier);
            }
            else
            {
                Element apiType = outputObject.createElement("apiType");
                if (type.equals("*"))
                {
                    apiType.setAttribute("value", "any");
                }
                else
                {
                    apiType.setAttribute("value", type);
                }
                apiValueDef.appendChild(apiType);
            }

            String fullDesc = null;

            NodeList descriptionList = ((Element)parent).getElementsByTagName("description");
            if (descriptionList != null && descriptionList.getLength() != 0)
            {
                fullDesc = descriptionList.item(0).getTextContent();
                Element apiDesc = outputObject.createElement("apiDesc");
                CDATASection cdata = outputObject.createCDATASection(asDocUtil.validateText(fullDesc, "description", fullName));
                apiDesc.appendChild(cdata);
                apiValueDetail.appendChild(apiDesc);
                asDocUtil.convertDescToDITA(apiDesc, oldNewNamesMap);
                shortdesc.setTextContent(asDocUtil.descToShortDesc(fullDesc));
            }

            children = ((Element)parent).getElementsByTagName("example");
            if (children != null)
            {
                for (int ix = 0; ix < children.getLength(); ix++)
                {
                    Element inputExampleElement = (Element)children.item(ix);

                    Element example = outputObject.createElement("example");

                    CDATASection cdata = outputObject.createCDATASection(asDocUtil.validateText(inputExampleElement.getTextContent(), "example", fullName));
                    example.appendChild(cdata);
                    apiValueDetail.appendChild(example);
                    asDocUtil.convertDescToDITA(example, oldNewNamesMap);
                }
            }

            children = ((Element)parent).getElementsByTagName("throws");
            if (children != null && children.getLength() != 0)
            {
                for (int ix = 0; ix < children.getLength(); ix++)
                {
                    Element throwsElement = (Element)children.item(ix);
                    apiValueDef.appendChild(createCanThrow(throwsElement, qualifiedFullName));
                }
            }

            processVersions((Element)parent, apiValue);
            processCustoms((Element)parent, apiValue, false, "", "", "");

            children = ((Element)parent).getElementsByTagName("eventType");
            if (children != null && children.getLength() != 0)
            {
                String eventNameStr = children.item(0).getTextContent();
                eventNameStr = eventNameStr.replaceAll("\\n", "");
                eventNameStr = eventNameStr.replaceAll("\\r", "");
                eventNameStr = asDocUtil.normalizeString(eventNameStr);

                int firstSpace = eventNameStr.indexOf(" ");
                if (firstSpace != -1)
                {
                    eventNameStr = eventNameStr.substring(0, firstSpace);
                }

                String eventId = asDocUtil.formatId(fullName) + "_" + eventNameStr;

                Element adobeApiEvent = outputObject.createElement("adobeApiEvent");
                adobeApiEvent.setAttribute("id", eventId);
                Element apiName2 = outputObject.createElement("apiName");
                apiName2.setTextContent(eventNameStr);
                adobeApiEvent.appendChild(apiName2);

                adobeApiEvent.appendChild(outputObject.createElement("prolog"));
                Element adobeApiEventDetail = outputObject.createElement("adobeApiEventDetail");
                adobeApiEvent.appendChild(adobeApiEventDetail);

                Element adobeApiEventDef = outputObject.createElement("adobeApiEventDef");
                adobeApiEventDetail.appendChild(adobeApiEventDef);

                Element apiEventType = outputObject.createElement("apiEventType");
                apiEventType.setTextContent(asDocUtil.formatId(fullName));
                adobeApiEventDef.appendChild(apiEventType);

                Element adobeApiEventClassifier = outputObject.createElement("adobeApiEventClassifier");
                adobeApiEventClassifier.setTextContent(myClass.getFullName());
                adobeApiEventDef.appendChild(adobeApiEventClassifier);

                Element apiDefinedEvent = outputObject.createElement("apiDefinedEvent");
                adobeApiEventDef.appendChild(apiDefinedEvent);

                processCustoms((Element)parent, adobeApiEvent, false, "", "", "");
                myClass.getNode().appendChild(adobeApiEvent);
                if (verbose)
                {
                    System.out.println("event handling for fields added event " + eventNameStr + " to class " + myClass.getNode().getNodeName());
                }

                if (descriptionList != null && descriptionList.getLength() != 0)
                {
                    myClass.getEventCommentTable().put(eventNameStr, descriptionList.item(0).getTextContent());
                }
            }

            if (myClass != null)
            {

                if (myClass.getFieldCount() == 0)
                {
                    Element fields = outputObject.createElement("fields");
                    fields.appendChild(apiValue);
                    myClass.setFields(fields);
                }
                else
                {
                    myClass.getFields().appendChild(apiValue);
                }

                myClass.setFieldCount(myClass.getFieldCount() + 1);
            }
            else
            {
                if (verbose)
                {
                    System.out.print("*** Internal error: can't find class for field: " + qualifiedFullName.getFullClassName());
                }
            }

            if (verbose)
            {
                System.out.println(" done  processing field: " + fullName);
            }
        }
    }