private JaxrsResourceLocatorDescription resLocatorDescription(
     ResourceClass resClass,
     String contextPath,
     String mapping,
     Collection<String> servletMappings,
     List<Class<?>> resolvedCls) {
   JaxrsResourceLocatorDescription locatorRes = new JaxrsResourceLocatorDescription();
   locatorRes.resourceClass = resClass.getClazz();
   resolvedCls.add(resClass.getClazz());
   for (ResourceMethod resMethod : resClass.getResourceMethods()) {
     JaxrsResourceMethodDescription jaxrsRes = new JaxrsResourceMethodDescription();
     jaxrsRes.consumeTypes = resMethod.getConsumes();
     jaxrsRes.contextPath = contextPath;
     jaxrsRes.httpMethods = resMethod.getHttpMethods();
     jaxrsRes.method = resMethod.getMethod();
     jaxrsRes.produceTypes = resMethod.getProduces();
     jaxrsRes.resourceClass = resClass.getClazz();
     String resPath =
         new StringBuilder(mapping)
             .append("/")
             .append(resMethod.getFullpath())
             .toString()
             .replace("//", "/");
     jaxrsRes.resourcePath = resPath;
     jaxrsRes.servletMappings = servletMappings;
     addMethodParameters(jaxrsRes, resMethod.getMethod());
     locatorRes.methodsDescriptions.add(jaxrsRes);
   }
   for (ResourceLocator resLocator : resClass.getResourceLocators()) {
     Class<?> clz = resLocator.getReturnType();
     if (clz.equals(resClass.getClazz())) {
       break;
     }
     if (resolvedCls.contains(clz)) {
       break;
     } else {
       resolvedCls.add(clz);
     }
     ResourceClass subResClass = ResourceBuilder.locatorFromAnnotations(clz);
     String subMapping =
         new StringBuilder(mapping)
             .append("/")
             .append(resLocator.getFullpath())
             .toString()
             .replace("//", "/");
     JaxrsResourceLocatorDescription inner =
         resLocatorDescription(subResClass, contextPath, subMapping, servletMappings, resolvedCls);
     if (inner.containsMethodResources()) {
       locatorRes.subLocatorDescriptions.add(inner);
     }
   }
   return locatorRes;
 }
Пример #2
0
 public ResourceClassBuilder buildMethod() {
   if (locator.resourceClass.getClazz().isAnonymousClass()) {
     locator.getMethod().setAccessible(true);
   }
   resourceClassBuilder.resourceLocators.add(locator);
   return resourceClassBuilder;
 }
Пример #3
0
 public T path(String path) {
   locator.path = path;
   return (T) this;
 }
Пример #4
0
 public LocatorMethodParameterBuilder param(int i) {
   return new LocatorMethodParameterBuilder(this, locator.getParams()[i]);
 }
Пример #5
0
 public T returnType(GenericType type) {
   locator.returnType = type.getRawType();
   locator.genericReturnType = type.getType();
   return (T) this;
 }
Пример #6
0
 public T genericReturnType(Type type) {
   locator.genericReturnType = type;
   return (T) this;
 }
Пример #7
0
 public T returnType(Class<?> type) {
   locator.returnType = type;
   return (T) this;
 }