Class ResourceMethodInfo

java.lang.Object
ru.vyarus.dropwizard.guice.url.model.ResourceMethodInfo

public class ResourceMethodInfo extends Object
The result of MethodCall analysis. Used to pre-fill request parameters by method annotations and provided arguments.

For sub resource call, subResources would not be empty, resource would point to the ROOT resource and path will be a method path, relative to resource root (include sub resource locator paths).

Since:
25.09.2025
  • Constructor Details

    • ResourceMethodInfo

      public ResourceMethodInfo(Class<?> resource, String resourcePath, Method method, String path, @Nullable String httpMethod)
      Create a resource method info object.
      Parameters:
      resource - resource class
      resourcePath - resource path
      method - analyzed method
      path - method path
      httpMethod - http method
    • ResourceMethodInfo

      public ResourceMethodInfo(Class<?> resource, String resourcePath, Method method, String path, @Nullable String httpMethod, @Nullable List<Class<?>> subResources, @Nullable List<ResourceMethodInfo> steps)
      Create a resource method info object for the call chain (including sub resource locators).
      Parameters:
      resource - resource class
      resourcePath - resource path
      method - analyzed method
      path - method path
      httpMethod - http method
      subResources - sub resource classes
      steps - separate analysis for each method call in the chain
  • Method Details

    • getResource

      public Class<?> getResource()
      Note: for sub-resources it is not required to have root Path annotation, for such classes here would be the root resource class.
      Returns:
      annotated resource class (where annotations declared)
    • getSubResources

      public List<Class<?>> getSubResources()
      Returns:
      sub resources or empty if direct resource method
    • getSteps

      public List<ResourceMethodInfo> getSteps()
      When sub resources used there would be multiple method calls resource.subResource().method(). In this case, each method call analyzed separately and, in some cases, non-aggregated data might be important (e.g. the only way to properly handle matrix params).
      Returns:
      separate methods analysis results for sub resource lookups or empty for single method call
    • getResourcePath

      public String getResourcePath()
      Returns:
      resource path (without method), resolved from Path annotation
    • getMethod

      public Method getMethod()
      This might not be directly called method, but superclass or interface method, where jersey annotations were found (note that jersey does not collect annotations from different places - it expects everything to be configured in one place).
      Returns:
      method with jersey annotations
    • getConsumes

      public List<String> getConsumes()
      Returns:
      Consumes annotation value from method or class
    • getProduces

      public List<String> getProduces()
      Returns:
      Produces annotation value from method or clas
    • getPathParams

      public Map<String,Object> getPathParams()
      Returns:
      map of not null arguments, passed for PathParam
    • getQueryParams

      public Map<String,Object> getQueryParams()
      Returns:
      map of not null arguments, passed for QueryParam
    • getHeaderParams

      public Map<String,Object> getHeaderParams()
      Returns:
      map of not null arguments, passed for HeaderParam
    • getCookieParams

      public Map<String,String> getCookieParams()
      Returns:
      map of not null arguments, passed for CookieParam
    • getFormParams

      public Map<String,Object> getFormParams()
      Returns:
      map of not null arguments, passed for FormParam or FormDataParam
    • getMatrixParams

      public Map<String,Object> getMatrixParams()
      Returns:
      map of not null arguments, passed for MatrixParam.
    • getPath

      public String getPath()
      Returns:
      method path, resolved from Path annotation
    • getHttpMethod

      public String getHttpMethod()
      Returns:
      http method, resolved from HttpMethod annotation inside GET, POST, etc.
    • getEntity

      public Object getEntity()
      Returns:
      entity object
    • setEntity

      public void setEntity(Object entity)
      Provided argument without known jersey annotations (assumed to be request body).
      Parameters:
      entity - entity object
    • getFullPath

      public String getFullPath()
      Returns:
      full method path (getResourcePath() with getPath())
    • apply

      public void apply(ResourceMethodInfo other)
      Apply other method info to this one.
      Parameters:
      other - other data
    • toString

      public String toString()
      Overrides:
      toString in class Object