cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1525841 - in /cxf/trunk/rt/rs/description/src: main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java test/java/org/apache/cxf/jaxrs/model/wadl/BookDescription.java test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java
Date Tue, 24 Sep 2013 10:51:52 GMT
Author: sergeyb
Date: Tue Sep 24 10:51:52 2013
New Revision: 1525841

URL: http://svn.apache.org/r1525841
Log:
[CXF-5289] WadlGenerator misses class-level Description annotations in some cases

Added:
    cxf/trunk/rt/rs/description/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookDescription.java
  (with props)
Modified:
    cxf/trunk/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
    cxf/trunk/rt/rs/description/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java

Modified: cxf/trunk/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java?rev=1525841&r1=1525840&r2=1525841&view=diff
==============================================================================
--- cxf/trunk/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
(original)
+++ cxf/trunk/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
Tue Sep 24 10:51:52 2013
@@ -235,16 +235,14 @@ public class WadlGenerator implements Co
         Set<ClassResourceInfo> visitedResources = new LinkedHashSet<ClassResourceInfo>();
         for (ClassResourceInfo cri : cris) {
             startResourceTag(sbResources, cri.getServiceClass(), cri.getURITemplate().getValue());
-            Annotation[] anns = cri.getServiceClass().getAnnotations();
-            if (anns.length == 0) {
-                Annotation ann = AnnotationUtils.getClassAnnotation(cri.getServiceClass(),
Description.class);
-                if (ann != null) {
-                    anns = new Annotation[] {
-                        ann
-                    };
-                }
+            
+            Annotation description = AnnotationUtils.getClassAnnotation(cri.getServiceClass(),
Description.class);
+            if (description == null) {
+                description = AnnotationUtils.getClassAnnotation(cri.getServiceClass(), Descriptions.class);
+            }
+            if (description != null) {
+                handleDocs(new Annotation[] {description}, sbResources, DocTarget.RESOURCE,
true, isJson);
             }
-            handleDocs(anns, sbResources, DocTarget.RESOURCE, true, isJson);
             handleResource(sbResources, allTypes, qnameResolver, clsMap, cri, visitedResources,
isJson);
             sbResources.append("</resource>");
         }

Added: cxf/trunk/rt/rs/description/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookDescription.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/description/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookDescription.java?rev=1525841&view=auto
==============================================================================
--- cxf/trunk/rt/rs/description/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookDescription.java
(added)
+++ cxf/trunk/rt/rs/description/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookDescription.java
Tue Sep 24 10:51:52 2013
@@ -0,0 +1,24 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.jaxrs.model.wadl;
+
+@Description(lang = "en-us", title = "book store \"resource\"", value = "super resource")
+public interface BookDescription {
+
+}

Propchange: cxf/trunk/rt/rs/description/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookDescription.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/rs/description/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookDescription.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/rt/rs/description/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/description/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java?rev=1525841&r1=1525840&r2=1525841&view=diff
==============================================================================
--- cxf/trunk/rt/rs/description/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java
(original)
+++ cxf/trunk/rt/rs/description/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java
Tue Sep 24 10:51:52 2013
@@ -49,8 +49,7 @@ import org.apache.cxf.jaxrs.model.wadl.j
 @Path("/bookstore/{id}")
 @Consumes({"application/xml", "application/json" })
 @Produces({"application/xml", "application/json" })
-@Description(lang = "en-us", title = "book store \"resource\"", value = "super resource")
-public class BookStore {
+public class BookStore implements BookDescription {
 
     @Descriptions({ 
         @Description(value = "Attachments, max < 10", target = DocTarget.PARAM)



Mime
View raw message