Skip to content
Browse files

added getters

  • Loading branch information...
1 parent 5f818b0 commit 38c6fdb3725435d916f1eb70d1c1993e23e5831f @michelegonella committed Sep 25, 2012
Showing with 29 additions and 0 deletions.
  1. +29 −0 zen-webservice/src/main/java/com/nominanuda/hyperapi/AnnotatedType.java
View
29 zen-webservice/src/main/java/com/nominanuda/hyperapi/AnnotatedType.java
@@ -18,7 +18,9 @@
import java.lang.annotation.Annotation;
import javax.ws.rs.Consumes;
+import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
import com.nominanuda.code.Nullable;
import com.nominanuda.lang.Check;
@@ -49,4 +51,31 @@ public boolean isAssignableFrom(Class<?> cl) {
}
return null;
}
+
+ public boolean isNullable() {
+ for(Annotation a : annotations) {
+ Class<? extends Annotation> t = a.annotationType();
+ if(Nullable.class.equals(t)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public Class<?> getType() {
+ return type;
+ }
+
+ public @Nullable String getNameInUri() {
+ for(Annotation a : annotations) {
+ Class<? extends Annotation> t = a.annotationType();
+ if(PathParam.class.equals(t)) {
+ return ((PathParam)a).value();
+ }
+ if(QueryParam.class.equals(t)) {
+ return ((QueryParam)a).value();
+ }
+ }
+ return null;
+ }
}

0 comments on commit 38c6fdb

Please sign in to comment.
Something went wrong with that request. Please try again.