Tabnine Logo
ReflectionUtils.getOverriddenMethod
Code IndexAdd Tabnine to your IDE (free)

How to use
getOverriddenMethod
method
in
io.swagger.v3.core.util.ReflectionUtils

Best Java code snippets using io.swagger.v3.core.util.ReflectionUtils.getOverriddenMethod (Showing top 10 results out of 315)

origin: swagger-api/swagger-core

/**
 * Returns an annotation by type from a method.
 *
 * @param method          is the method to find
 * @param annotationClass is the type of annotation
 * @param <A>             is the type of annotation
 * @return annotation if it is found
 */
public static <A extends Annotation> A getAnnotation(Method method, Class<A> annotationClass) {
  A annotation = method.getAnnotation(annotationClass);
  if (annotation == null) {
    for (Annotation metaAnnotation : method.getAnnotations()) {
      annotation = metaAnnotation.annotationType().getAnnotation(annotationClass);
      if (annotation != null) {
        return annotation;
      }
    }
    Method superclassMethod = getOverriddenMethod(method);
    if (superclassMethod != null) {
      annotation = getAnnotation(superclassMethod, annotationClass);
    }
  }
  return annotation;
}
origin: swagger-api/swagger-core

public static Annotation[][] getParameterAnnotations(Method method) {
  Annotation[][] methodAnnotations = method.getParameterAnnotations();
  Method overriddenmethod = getOverriddenMethod(method);
  if (overriddenmethod != null) {
    Annotation[][] overriddenAnnotations = overriddenmethod
        .getParameterAnnotations();
    for (int i = 0; i < methodAnnotations.length; i++) {
      List<Type> types = new ArrayList<>();
      for (int j = 0; j < methodAnnotations[i].length; j++) {
        types.add(methodAnnotations[i][j].annotationType());
      }
      for (int j = 0; j < overriddenAnnotations[i].length; j++) {
        if (!types.contains(overriddenAnnotations[i][j]
            .annotationType())) {
          methodAnnotations[i] = ArrayUtils.add(
              methodAnnotations[i],
              overriddenAnnotations[i][j]);
        }
      }
    }
  }
  return methodAnnotations;
}
origin: swagger-api/swagger-core

public static String extractOperationMethod(Method method, Iterator<OpenAPIExtension> chain) {
  if (method.getAnnotation(javax.ws.rs.GET.class) != null) {
    return GET_METHOD;
  } else if (method.getAnnotation(javax.ws.rs.PUT.class) != null) {
    return PUT_METHOD;
  } else if (method.getAnnotation(javax.ws.rs.POST.class) != null) {
    return POST_METHOD;
  } else if (method.getAnnotation(javax.ws.rs.DELETE.class) != null) {
    return DELETE_METHOD;
  } else if (method.getAnnotation(javax.ws.rs.OPTIONS.class) != null) {
    return OPTIONS_METHOD;
  } else if (method.getAnnotation(javax.ws.rs.HEAD.class) != null) {
    return HEAD_METHOD;
  } else if (method.getAnnotation(DELETE.class) != null) {
    return DELETE_METHOD;
  } else if (method.getAnnotation(HttpMethod.class) != null) {
    HttpMethod httpMethod = method.getAnnotation(HttpMethod.class);
    return httpMethod.value().toLowerCase();
  } else if (!StringUtils.isEmpty(getHttpMethodFromCustomAnnotations(method))) {
    return getHttpMethodFromCustomAnnotations(method);
  } else if ((ReflectionUtils.getOverriddenMethod(method)) != null) {
    return extractOperationMethod(ReflectionUtils.getOverriddenMethod(method), chain);
  } else if (chain != null && chain.hasNext()) {
    return chain.next().extractOperationMethod(method, chain);
  } else {
    return null;
  }
}
origin: swagger-api/swagger-core

@Test
public void getOverriddenMethodTest() throws NoSuchMethodException {
  final Method method1 = ReflectionUtils.getOverriddenMethod(
      Child.class.getMethod("parametrizedMethod1", Integer.class));
  Assert.assertNotNull(method1);
  Assert.assertEquals(method1.getParameterTypes()[0], Number.class);
  final Method method2 = ReflectionUtils.getOverriddenMethod(
      Child.class.getMethod("parametrizedMethod2", Long.class));
  Assert.assertNotNull(method2);
  Assert.assertEquals(method2.getParameterTypes()[0], Number.class);
  final Method method3 = ReflectionUtils.getOverriddenMethod(
      Child.class.getMethod("parametrizedMethod3", Long.class));
  Assert.assertNull(method3);
  Assert.assertNull(ReflectionUtils.getOverriddenMethod(Object.class.getMethod("equals", Object.class)));
}
origin: swagger-api/swagger-core

/**
 * Returns a List of repeatable annotations by type from a method.
 *
 * @param method          is the method to find
 * @param annotationClass is the type of annotation
 * @param <A>             is the type of annotation
 * @return List of repeatable annotations if it is found
 */
public static <A extends Annotation> List<A> getRepeatableAnnotations(Method method, Class<A> annotationClass) {
  A[] annotations = method.getAnnotationsByType(annotationClass);
  if (annotations == null || annotations.length == 0) {
    for (Annotation metaAnnotation : method.getAnnotations()) {
      annotations = metaAnnotation.annotationType().getAnnotationsByType(annotationClass);
      if (annotations != null && annotations.length > 0) {
        return Arrays.asList(annotations);
      }
    }
    Method superclassMethod = getOverriddenMethod(method);
    if (superclassMethod != null) {
      return getRepeatableAnnotations(superclassMethod, annotationClass);
    }
  }
  if (annotations == null) {
    return null;
  }
  return Arrays.asList(annotations);
}
origin: io.swagger.core.v3/swagger-core

public static Annotation[][] getParameterAnnotations(Method method) {
  Annotation[][] methodAnnotations = method.getParameterAnnotations();
  Method overriddenmethod = getOverriddenMethod(method);
  if (overriddenmethod != null) {
    Annotation[][] overriddenAnnotations = overriddenmethod
        .getParameterAnnotations();
    for (int i = 0; i < methodAnnotations.length; i++) {
      List<Type> types = new ArrayList<>();
      for (int j = 0; j < methodAnnotations[i].length; j++) {
        types.add(methodAnnotations[i][j].annotationType());
      }
      for (int j = 0; j < overriddenAnnotations[i].length; j++) {
        if (!types.contains(overriddenAnnotations[i][j]
            .annotationType())) {
          methodAnnotations[i] = ArrayUtils.add(
              methodAnnotations[i],
              overriddenAnnotations[i][j]);
        }
      }
    }
  }
  return methodAnnotations;
}
origin: io.swagger.core.v3/swagger-core

/**
 * Returns an annotation by type from a method.
 *
 * @param method          is the method to find
 * @param annotationClass is the type of annotation
 * @param <A>             is the type of annotation
 * @return annotation if it is found
 */
public static <A extends Annotation> A getAnnotation(Method method, Class<A> annotationClass) {
  A annotation = method.getAnnotation(annotationClass);
  if (annotation == null) {
    for (Annotation metaAnnotation : method.getAnnotations()) {
      annotation = metaAnnotation.annotationType().getAnnotation(annotationClass);
      if (annotation != null) {
        return annotation;
      }
    }
    Method superclassMethod = getOverriddenMethod(method);
    if (superclassMethod != null) {
      annotation = getAnnotation(superclassMethod, annotationClass);
    }
  }
  return annotation;
}
origin: io.swagger.core.v3/swagger-jaxrs2

public static String extractOperationMethod(Method method, Iterator<OpenAPIExtension> chain) {
  if (method.getAnnotation(javax.ws.rs.GET.class) != null) {
    return GET_METHOD;
  } else if (method.getAnnotation(javax.ws.rs.PUT.class) != null) {
    return PUT_METHOD;
  } else if (method.getAnnotation(javax.ws.rs.POST.class) != null) {
    return POST_METHOD;
  } else if (method.getAnnotation(javax.ws.rs.DELETE.class) != null) {
    return DELETE_METHOD;
  } else if (method.getAnnotation(javax.ws.rs.OPTIONS.class) != null) {
    return OPTIONS_METHOD;
  } else if (method.getAnnotation(javax.ws.rs.HEAD.class) != null) {
    return HEAD_METHOD;
  } else if (method.getAnnotation(DELETE.class) != null) {
    return DELETE_METHOD;
  } else if (method.getAnnotation(HttpMethod.class) != null) {
    HttpMethod httpMethod = method.getAnnotation(HttpMethod.class);
    return httpMethod.value().toLowerCase();
  } else if (!StringUtils.isEmpty(getHttpMethodFromCustomAnnotations(method))) {
    return getHttpMethodFromCustomAnnotations(method);
  } else if ((ReflectionUtils.getOverriddenMethod(method)) != null) {
    return extractOperationMethod(ReflectionUtils.getOverriddenMethod(method), chain);
  } else if (chain != null && chain.hasNext()) {
    return chain.next().extractOperationMethod(method, chain);
  } else {
    return null;
  }
}
origin: io.swagger.core.v3/swagger-core

/**
 * Returns a List of repeatable annotations by type from a method.
 *
 * @param method          is the method to find
 * @param annotationClass is the type of annotation
 * @param <A>             is the type of annotation
 * @return List of repeatable annotations if it is found
 */
public static <A extends Annotation> List<A> getRepeatableAnnotations(Method method, Class<A> annotationClass) {
  A[] annotations = method.getAnnotationsByType(annotationClass);
  if (annotations == null || annotations.length == 0) {
    for (Annotation metaAnnotation : method.getAnnotations()) {
      annotations = metaAnnotation.annotationType().getAnnotationsByType(annotationClass);
      if (annotations != null && annotations.length > 0) {
        return Arrays.asList(annotations);
      }
    }
    Method superclassMethod = getOverriddenMethod(method);
    if (superclassMethod != null) {
      return getRepeatableAnnotations(superclassMethod, annotationClass);
    }
  }
  if (annotations == null) {
    return null;
  }
  return Arrays.asList(annotations);
}
origin: noboomu/proteus

Method overriddenmethod = ReflectionUtils.getOverriddenMethod(method);
io.swagger.v3.core.utilReflectionUtilsgetOverriddenMethod

Javadoc

Returns overridden method from superclass if it exists. If method was not found returns null.

Popular methods of ReflectionUtils

  • getAnnotation
    Returns an annotation by type from a method.
  • getRepeatableAnnotationsArray
  • isOverriddenMethod
    Checks if the method methodToFind is the overridden method from the superclass or superinterface.
  • getDeclaredFields
    Returns the list of declared fields from the class cls and its superclasses excluding Object class.
  • getRepeatableAnnotations
    Returns a List of repeatable annotations by type from a method.
  • findMethod
    Searches the method methodToFind in given class cls. If the method is found returns it, else return
  • getParameterAnnotations
  • isConstructorCompatible
  • isInject
  • hasIdenticalParameters
  • isSystemType
  • isVoid
    Checks if the type is void.
  • isSystemType,
  • isVoid,
  • loadClassByName,
  • typeFromString

Popular in Java

  • Making http post requests using okhttp
  • notifyDataSetChanged (ArrayAdapter)
  • onCreateOptionsMenu (Activity)
  • scheduleAtFixedRate (Timer)
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now