summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/main/java/org
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2010-04-30 17:15:46 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2010-04-30 17:15:46 +0000
commit80ca73f521b9c70ebe9bfdd6b43fde09ff6b799e (patch)
tree08a31936a4e05a254b239dd6b886d8daefca7752 /sca-java-2.x/trunk/modules/interface-java-jaxrs/src/main/java/org
parentde9dd8022386ad4dd39d96591840ebe1987a4cbd (diff)
Enhancing processing of JAX-RS interfaces, and fixing typo on the annotation used for delete operations
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@939743 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/interface-java-jaxrs/src/main/java/org')
-rw-r--r--sca-java-2.x/trunk/modules/interface-java-jaxrs/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/JAXRSJavaInterfaceProcessor.java40
1 files changed, 19 insertions, 21 deletions
diff --git a/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/JAXRSJavaInterfaceProcessor.java b/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/JAXRSJavaInterfaceProcessor.java
index ff3229771d..49fbb31a30 100644
--- a/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/JAXRSJavaInterfaceProcessor.java
+++ b/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/JAXRSJavaInterfaceProcessor.java
@@ -21,7 +21,6 @@ package org.apache.tuscany.sca.interfacedef.java.jaxrs;
import java.lang.reflect.Method;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import javax.ws.rs.DELETE;
@@ -48,8 +47,8 @@ public class JAXRSJavaInterfaceProcessor implements JavaInterfaceVisitor {
boolean hasJAXRSAnnotarions = false;
- for (Iterator<Operation> it = contract.getOperations().iterator(); it.hasNext();) {
- final JavaOperation operation = (JavaOperation)it.next();
+ for (Operation op : contract.getOperations()) {
+ final JavaOperation operation = (JavaOperation)op;
final Method method = operation.getJavaMethod();
GET get = method.getAnnotation(GET.class);
@@ -58,22 +57,13 @@ public class JAXRSJavaInterfaceProcessor implements JavaInterfaceVisitor {
operation.getAttributes().put(GET.class, true);
getOperations.add(operation);
}
-
- if(! getOperations.isEmpty()) {
- contract.getAttributes().put(GET.class, getOperations);
- }
-
+
PUT put = method.getAnnotation(PUT.class);
if(put != null) {
hasJAXRSAnnotarions = true;
operation.getAttributes().put(PUT.class, true);
putOperations.add(operation);
}
-
- if(! putOperations.isEmpty()) {
- contract.getAttributes().put(PUT.class, putOperations);
- }
-
POST post = method.getAnnotation(POST.class);
if(post != null) {
@@ -81,10 +71,6 @@ public class JAXRSJavaInterfaceProcessor implements JavaInterfaceVisitor {
operation.getAttributes().put(POST.class, true);
postOperations.add(operation);
}
-
- if(! postOperations.isEmpty()) {
- contract.getAttributes().put(POST.class, postOperations);
- }
DELETE delete = method.getAnnotation(DELETE.class);
if(delete != null) {
@@ -92,12 +78,24 @@ public class JAXRSJavaInterfaceProcessor implements JavaInterfaceVisitor {
operation.getAttributes().put(DELETE.class, true);
deleteOperations.add(operation);
}
+ }
+
+ if(! getOperations.isEmpty()) {
+ contract.getAttributes().put(GET.class, getOperations);
+ }
- if(! deleteOperations.isEmpty()) {
- contract.getAttributes().put(GET.class, deleteOperations);
- }
-
+ if(! putOperations.isEmpty()) {
+ contract.getAttributes().put(PUT.class, putOperations);
}
+
+ if(! postOperations.isEmpty()) {
+ contract.getAttributes().put(POST.class, postOperations);
+ }
+
+ if(! deleteOperations.isEmpty()) {
+ contract.getAttributes().put(DELETE.class, deleteOperations);
+ }
+
// Always set JAX-RS annotated interfaces as remotables
if (hasJAXRSAnnotarions) {