cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: Updating WadlGenerator to support mulltiple doc providers
Date Mon, 11 May 2015 20:07:40 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 6ceec1720 -> eb3894575


Updating WadlGenerator to support mulltiple doc providers


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/eb389457
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/eb389457
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/eb389457

Branch: refs/heads/3.0.x-fixes
Commit: eb38945750380100e789e304d1af61d72b57a079
Parents: 6ceec17
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Mon May 11 21:05:15 2015 +0100
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Mon May 11 21:07:15 2015 +0100

----------------------------------------------------------------------
 .../cxf/jaxrs/model/wadl/WadlGenerator.java     | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/eb389457/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
----------------------------------------------------------------------
diff --git a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
index 8974f1e..24de86b 100644
--- a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
+++ b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
@@ -180,7 +180,7 @@ public class WadlGenerator implements ContainerRequestFilter {
     private String stylesheetReference;
     private boolean applyStylesheetLocally;
     private Bus bus;
-    private DocumentationProvider docProvider;
+    private List<DocumentationProvider> docProviders = new LinkedList<DocumentationProvider>();
     private ResourceIdGenerator idGenerator;     
     
     public WadlGenerator() {
@@ -941,7 +941,7 @@ public class WadlGenerator implements ContainerRequestFilter {
                                         boolean isJson) {
     //CHECKSTYLE:ON    
         boolean docAnnAvailable = isDocAvailable(anns);
-        if (docAnnAvailable || (ori != null && docProvider != null)) {
+        if (docAnnAvailable || (ori != null && !docProviders.isEmpty())) {
             sb.append(">");
             if (docAnnAvailable) {
                 handleDocs(anns, sb, category, allowDefault, isJson);
@@ -1650,19 +1650,19 @@ public class WadlGenerator implements ContainerRequestFilter {
     }
 
     protected void handleClassJavaDocs(ClassResourceInfo cri, StringBuilder sb) {
-        if (docProvider != null) {
+        for (DocumentationProvider docProvider : docProviders) {
             addProvidedDocs(sb, docProvider.getClassDoc(cri));
         }
     }
     
     protected void handleOperJavaDocs(OperationResourceInfo ori, StringBuilder sb) {
-        if (docProvider != null) {
+        for (DocumentationProvider docProvider : docProviders) {
             addProvidedDocs(sb, docProvider.getMethodDoc(ori));
         }
     }
     
     protected void handleOperResponseJavaDocs(OperationResourceInfo ori, StringBuilder sb)
{
-        if (docProvider != null) {
+        for (DocumentationProvider docProvider : docProviders) {
             addProvidedDocs(sb, docProvider.getMethodResponseDoc(ori));
         }
     }
@@ -1670,7 +1670,7 @@ public class WadlGenerator implements ContainerRequestFilter {
     protected void handleOperParamJavaDocs(OperationResourceInfo ori,
                                            int paramIndex,
                                            StringBuilder sb) {
-        if (docProvider != null) {
+        for (DocumentationProvider docProvider : docProviders) {
             addProvidedDocs(sb, docProvider.getMethodParameterDoc(ori, paramIndex));
         }
     }
@@ -2128,13 +2128,15 @@ public class WadlGenerator implements ContainerRequestFilter {
     }
     
     public void setJavaDocPath(String path) throws Exception {
-        docProvider = new JavaDocProvider(bus == null ? BusFactory.getDefaultBus() : bus,
path);
+        setDocumentationProvider(new JavaDocProvider(bus == null ? BusFactory.getDefaultBus()
: bus, path));
     }
     
     public void setDocumentationProvider(DocumentationProvider p) {
-        docProvider = p;
+        docProviders.add(p);
+    }
+    public void setDocumentationProvider(List<DocumentationProvider> ps) {
+        docProviders.addAll(ps);
     }
-
     public void setStylesheetReference(String stylesheetReference) {
         this.stylesheetReference = stylesheetReference;
     }


Mime
View raw message