Examples of DocumentationExample


Examples of org.codehaus.enunciate.doc.DocumentationExample

  protected void generateExampleXml(Attribute attribute, org.jdom.Element parent, String defaultNs) {
    if (!includeDeprecatedFieldsInExample && attribute.getAnnotation(Deprecated.class) != null) {
      return;
    }
    DocumentationExample exampleInfo = attribute.getAnnotation(DocumentationExample.class);
    if (exampleInfo == null || !exampleInfo.exclude()) {
      String namespace = attribute.getNamespace();
      String prefix = namespace == null ? null : ((EnunciateFreemarkerModel) FreemarkerModel.get()).getNamespacesToPrefixes().get(namespace);
      String exampleValue = exampleInfo == null || "##default".equals(exampleInfo.value()) ? "..." : exampleInfo.value();
      Namespace jdomNS;
      if (Namespace.XML_NAMESPACE.getURI().equals(namespace)) {
        jdomNS = Namespace.XML_NAMESPACE;
      }
      else if (namespace == null || "".equals(namespace) || namespace.equals(defaultNs)) {
View Full Code Here

Examples of org.codehaus.enunciate.doc.DocumentationExample

      parent.setAttribute(attr);
    }
  }

  protected void generateExampleXml(Value value, org.jdom.Element parent) {
    DocumentationExample exampleInfo = value.getAnnotation(DocumentationExample.class);
    if (exampleInfo == null || !exampleInfo.exclude()) {
      parent.setContent(new Text(exampleInfo == null || "##default".equals(exampleInfo.value()) ? "..." : exampleInfo.value()));
    }
  }
View Full Code Here

Examples of org.codehaus.enunciate.doc.DocumentationExample

    }
    if (!includeDeprecatedFieldsInExample && element.getAnnotation(Deprecated.class) != null) {
      return;
    }

    DocumentationExample exampleInfo = element.getAnnotation(DocumentationExample.class);
    if (exampleInfo == null || !exampleInfo.exclude()) {
      if (element.isWrapped()) {
        String namespace = element.getWrapperNamespace();
        String prefix = namespace == null ? null : ((EnunciateFreemarkerModel) FreemarkerModel.get()).getNamespacesToPrefixes().get(namespace);
        Namespace jdomNS;
        if (Namespace.XML_NAMESPACE.getURI().equals(namespace)) {
          jdomNS = Namespace.XML_NAMESPACE;
        }
        else if (namespace == null || "".equals(namespace)) {
          jdomNS = Namespace.NO_NAMESPACE;
        }
        else if (namespace.equals(defaultNs)) {
          jdomNS = Namespace.getNamespace("", namespace);
        }
        else {
          jdomNS = Namespace.getNamespace(prefix, namespace);
        }
        org.jdom.Element el = new org.jdom.Element(element.getWrapperName(), jdomNS);
        parent.addContent(el);
        parent = el;
      }

      for (Element choice : element.getChoices()) {
        QName ref = choice.getRef();
        int iterations = "1".equals(choice.getMaxOccurs()) ? 1 : 2;
        for (int i = 0; i < iterations; i++) {
          if (ref == null) {
            String namespace = choice.getNamespace();
            String prefix = namespace == null ? null : ((EnunciateFreemarkerModel) FreemarkerModel.get()).getNamespacesToPrefixes().get(namespace);
            Namespace jdomNS;
            if (Namespace.XML_NAMESPACE.getURI().equals(namespace)) {
              jdomNS = Namespace.XML_NAMESPACE;
            }
            else if (namespace == null || "".equals(namespace)) {
              if (choice.getTypeDefinition().getSchema().getElementFormDefault() == XmlNsForm.QUALIFIED) {
                jdomNS = Namespace.NO_NAMESPACE;
              }
              else {
                jdomNS = Namespace.getNamespace("", namespace);
              }
            }
            else if (namespace.equals(defaultNs)) {
              jdomNS = Namespace.getNamespace("", namespace);
            }
            else {
              jdomNS = Namespace.getNamespace(prefix, namespace);
            }
            org.jdom.Element el = new org.jdom.Element(choice.getName(), jdomNS);
            String exampleValue = exampleInfo == null || "##default".equals(exampleInfo.value()) ? "..." : exampleInfo.value();
            XmlType xmlType = choice.getBaseType();
            if (i == 0) {
              generateExampleXml(xmlType, el, exampleValue, defaultNs, maxDepth);
            }
            else {
View Full Code Here

Examples of org.codehaus.enunciate.doc.DocumentationExample

    }
    if (!includeDeprecatedFieldsInExample && attribute.getAnnotation(Deprecated.class) != null) {
      return;
    }

    DocumentationExample exampleInfo = attribute.getAnnotation(DocumentationExample.class);
    if (exampleInfo == null || !exampleInfo.exclude()) {
      JsonNode valueNode = generateExampleJson(attribute.getBaseType(), exampleInfo == null || "##default".equals(exampleInfo.value()) ? null : exampleInfo.value(), maxDepth);
      jsonNode.put(attribute.getJsonMemberName(), valueNode);
    }
  }
View Full Code Here

Examples of org.codehaus.enunciate.doc.DocumentationExample

  protected void generateExampleJson(Value value, ObjectNode jsonNode, int maxDepth) {
    if (TYPE_DEF_STACK.get().size() > maxDepth) {
      return;
    }

    DocumentationExample exampleInfo = value.getAnnotation(DocumentationExample.class);
    if (exampleInfo == null || !exampleInfo.exclude()) {
      JsonNode valueNode = generateExampleJson(value.getBaseType(), exampleInfo == null || "##default".equals(exampleInfo.value()) ? null : exampleInfo.value(), maxDepth);
      jsonNode.put(value.getJsonMemberName(), valueNode);
    }
  }
View Full Code Here

Examples of org.codehaus.enunciate.doc.DocumentationExample

    }
    if (!includeDeprecatedFieldsInExample && element.getAnnotation(Deprecated.class) != null) {
      return;
    }

    DocumentationExample exampleInfo = element.getAnnotation(DocumentationExample.class);
    if (exampleInfo == null || !exampleInfo.exclude()) {
      String name = element.getJsonMemberName();
      JsonNode elementNode;
      if (!element.isCollectionType()) {
        String exampleValue = exampleInfo == null || "##default".equals(exampleInfo.value()) ? "..." : exampleInfo.value();
        if (!element.isElementRefs() && element.getRef() == null) {
          elementNode = generateExampleJson(element.getBaseType(), exampleValue, maxDepth);
        }
        else {
          elementNode = JsonNodeFactory.instance.objectNode();
        }
      }
      else {
        ArrayNode exampleChoices = JsonNodeFactory.instance.arrayNode();
        for (Element choice : element.getChoices()) {
          QName ref = choice.isElementRefs() ? null : choice.getRef();
          int iterations = "1".equals(choice.getMaxOccurs()) ? 1 : 2;
          for (int i = 0; i < iterations; i++) {
            if (!choice.isElementRefs() && ref == null) {
              String exampleValue = exampleInfo == null || "##default".equals(exampleInfo.value()) ? null : exampleInfo.value();
              XmlType xmlType = choice.getBaseType();
              if (i == 0) {
                exampleChoices.add(generateExampleJson(xmlType, exampleValue, maxDepth));
              }
              else {
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.