private TimingResourceFilter(
     AbstractMethod abstractMethod,
     LoadingCache<String, RequestStats> requestStatsLoadingCache) {
   this.abstractMethod = abstractMethod;
   String objectName =
       new ObjectNameBuilder(
               abstractMethod.getResource().getResourceClass().getPackage().getName())
           .withProperty("type", abstractMethod.getResource().getResourceClass().getSimpleName())
           .build();
   RequestStats requestStats = requestStatsLoadingCache.getUnchecked(objectName);
   timingFilter = new TimingFilter(this.abstractMethod, requestStats);
 }
  @Override
  public List<ResourceFilter> create(AbstractMethod abstractMethod) {
    if (!(abstractMethod instanceof AbstractResourceMethod)) {
      return null;
    }

    Method method = abstractMethod.getMethod();
    Class<?> klass = method.getDeclaringClass();
    List<ResourceFilter> filters = newArrayList();

    // check for impossible combinations
    if (method.isAnnotationPresent(OPTIONS.class) && method.isAnnotationPresent(Cors.class)) {
      logger.error(
          "Resource method "
              + abstractMethod
              + " is annotated with @Cors, which is not applicable for methods annotated with @OPTIONS");
      return null;
    } else if (!method.isAnnotationPresent(OPTIONS.class)
        && method.isAnnotationPresent(CorsPreflight.class)) {
      logger.error(
          "Resource method "
              + abstractMethod
              + " is annotated with @CorsPreflight, which is only applicable for methods annotated with @OPTIONS");
      return null;
    }

    addCorsFilter(method, klass, filters);

    addCorsPreflightFilter(method, klass, filters);

    return filters;
  }
 @Override
 public List<ResourceFilter> create(AbstractMethod am) {
   Versions versions = am.getAnnotation(Versions.class);
   List<String> supportedVersions = new ArrayList<String>();
   if (versions != null) {
     supportedVersions = Arrays.asList(versions.version());
     return Collections.<ResourceFilter>singletonList(new VersionFilter(supportedVersions));
   }
   return null;
 }