Search in sources :

Example 1 with WrappedElementInfo

use of com.zimbra.soap.util.WrappedElementInfo in project zm-mailbox by Zimbra.

the class XmlElementDescription method addXmlInfo.

/**
     * Populate {@link desc} with value, attribute and sub-element information
     */
private static void addXmlInfo(XmlElementDescription desc, JaxbInfo jaxbInfo) {
    JaxbValueInfo valueInfo = jaxbInfo.getElementValue();
    if (valueInfo != null) {
        desc.valueFieldName = valueInfo.getFieldName();
        desc.valueType = ValueDescription.create(desc.valueFieldName, valueInfo.getAtomClass());
        desc.elementText = desc.valueType.getRepresentation();
    }
    for (JaxbAttributeInfo attrInfo : jaxbInfo.getAttributes()) {
        desc.attribs.add(XmlAttributeDescription.create(desc, attrInfo));
    }
    for (JaxbNodeInfo nodeInfo : jaxbInfo.getJaxbNodeInfos()) {
        if (nodeInfo instanceof WrappedElementInfo) {
            desc.children.add(XmlElementDescription.createForWrappedElement(desc, (WrappedElementInfo) nodeInfo));
        } else if (nodeInfo instanceof JaxbElementInfo) {
            desc.children.add(XmlElementDescription.createForElement(desc, (JaxbElementInfo) nodeInfo));
        } else if (nodeInfo instanceof JaxbPseudoNodeChoiceInfo) {
            JaxbPseudoNodeChoiceInfo jaxbChoice = (JaxbPseudoNodeChoiceInfo) nodeInfo;
            ChoiceNode choiceNode = new ChoiceNode(jaxbChoice.isMultiElement());
            desc.children.add(choiceNode);
            for (JaxbElementInfo choice : jaxbChoice.getElements()) {
                choiceNode.addChild(XmlElementDescription.createForElement(desc, choice));
            }
        }
    }
}
Also used : JaxbPseudoNodeChoiceInfo(com.zimbra.soap.util.JaxbPseudoNodeChoiceInfo) JaxbAttributeInfo(com.zimbra.soap.util.JaxbAttributeInfo) JaxbValueInfo(com.zimbra.soap.util.JaxbValueInfo) JaxbNodeInfo(com.zimbra.soap.util.JaxbNodeInfo) JaxbElementInfo(com.zimbra.soap.util.JaxbElementInfo) WrappedElementInfo(com.zimbra.soap.util.WrappedElementInfo)

Aggregations

JaxbAttributeInfo (com.zimbra.soap.util.JaxbAttributeInfo)1 JaxbElementInfo (com.zimbra.soap.util.JaxbElementInfo)1 JaxbNodeInfo (com.zimbra.soap.util.JaxbNodeInfo)1 JaxbPseudoNodeChoiceInfo (com.zimbra.soap.util.JaxbPseudoNodeChoiceInfo)1 JaxbValueInfo (com.zimbra.soap.util.JaxbValueInfo)1 WrappedElementInfo (com.zimbra.soap.util.WrappedElementInfo)1