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

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

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

origin: swagger-api/swagger-core

annotation = getAnnotation(superClass, annotationClass);
annotation = getAnnotation(anInterface, annotationClass);
if (annotation != null) {
  return annotation;
origin: swagger-api/swagger-core

protected boolean isOperationHidden(Method method) {
  io.swagger.v3.oas.annotations.Operation apiOperation = ReflectionUtils.getAnnotation(method, io.swagger.v3.oas.annotations.Operation.class);
  if (apiOperation != null && apiOperation.hidden()) {
    return true;
  }
  Hidden hidden = method.getAnnotation(Hidden.class);
  if (hidden != null) {
    return true;
  }
  if (config != null && !Boolean.TRUE.equals(config.isReadAllResources()) && apiOperation == null) {
    return true;
  }
  return false;
}
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

@Test
public void getAnnotationTest() throws NoSuchMethodException {
  final Method method = Child.class.getMethod("annotationHolder");
  Assert.assertNotNull(ReflectionUtils.getAnnotation(method, Schema.class));
  Assert.assertNull(ReflectionUtils.getAnnotation(method, ApiResponse.class));
}
origin: swagger-api/swagger-core

@Test
public void testDerivedAnnotation() {
  final Path annotation = ReflectionUtils.getAnnotation(Child.class, javax.ws.rs.Path.class);
  Assert.assertNotNull(annotation);
  Assert.assertEquals(annotation.value(), "parentInterfacePath");
}
origin: swagger-api/swagger-core

final javax.ws.rs.Path apiPath = ReflectionUtils.getAnnotation(cls, javax.ws.rs.Path.class);
ExternalDocumentation apiExternalDocs = ReflectionUtils.getAnnotation(cls, ExternalDocumentation.class);
io.swagger.v3.oas.annotations.tags.Tag[] apiTags = ReflectionUtils.getRepeatableAnnotationsArray(cls, io.swagger.v3.oas.annotations.tags.Tag.class);
io.swagger.v3.oas.annotations.servers.Server[] apiServers = ReflectionUtils.getRepeatableAnnotationsArray(cls, io.swagger.v3.oas.annotations.servers.Server.class);
javax.ws.rs.Consumes classConsumes = ReflectionUtils.getAnnotation(cls, javax.ws.rs.Consumes.class);
javax.ws.rs.Produces classProduces = ReflectionUtils.getAnnotation(cls, javax.ws.rs.Produces.class);
OpenAPIDefinition openAPIDefinition = ReflectionUtils.getAnnotation(cls, OpenAPIDefinition.class);
  javax.ws.rs.Produces methodProduces = ReflectionUtils.getAnnotation(method, javax.ws.rs.Produces.class);
  javax.ws.rs.Consumes methodConsumes = ReflectionUtils.getAnnotation(method, javax.ws.rs.Consumes.class);
  javax.ws.rs.Path methodPath = ReflectionUtils.getAnnotation(method, javax.ws.rs.Path.class);
    io.swagger.v3.oas.annotations.Operation apiOperation = ReflectionUtils.getAnnotation(method, io.swagger.v3.oas.annotations.Operation.class);
    JsonView jsonViewAnnotation;
    JsonView jsonViewAnnotationForRequestBody;
      jsonViewAnnotationForRequestBody = null;
    } else {
      jsonViewAnnotation = ReflectionUtils.getAnnotation(method, JsonView.class);
io.swagger.v3.oas.annotations.Operation apiOperation = ReflectionUtils.getAnnotation(method, io.swagger.v3.oas.annotations.Operation.class);
List<io.swagger.v3.oas.annotations.responses.ApiResponse> apiResponses = ReflectionUtils.getRepeatableAnnotations(method, io.swagger.v3.oas.annotations.responses.ApiResponse.class);
io.swagger.v3.oas.annotations.parameters.RequestBody apiRequestBody =
    ReflectionUtils.getAnnotation(method, io.swagger.v3.oas.annotations.parameters.RequestBody.class);
origin: io.swagger.core.v3/swagger-core

annotation = getAnnotation(superClass, annotationClass);
annotation = getAnnotation(anInterface, annotationClass);
if (annotation != null) {
  return annotation;
origin: io.swagger.core.v3/swagger-jaxrs2

protected boolean isOperationHidden(Method method) {
  io.swagger.v3.oas.annotations.Operation apiOperation = ReflectionUtils.getAnnotation(method, io.swagger.v3.oas.annotations.Operation.class);
  if (apiOperation != null && apiOperation.hidden()) {
    return true;
  }
  Hidden hidden = method.getAnnotation(Hidden.class);
  if (hidden != null) {
    return true;
  }
  if (config != null && !Boolean.TRUE.equals(config.isReadAllResources()) && apiOperation == null) {
    return true;
  }
  return false;
}
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: noboomu/proteus

protected boolean isOperationHidden(Method method)
{
  io.swagger.v3.oas.annotations.Operation apiOperation = ReflectionUtils.getAnnotation(method, io.swagger.v3.oas.annotations.Operation.class);
  if (apiOperation != null && apiOperation.hidden())
  {
    return true;
  }
  Hidden hidden = method.getAnnotation(Hidden.class);
  if (hidden != null)
  {
    return true;
  }
  if (config != null && !Boolean.TRUE.equals(config.isReadAllResources()) && apiOperation == null)
  {
    return true;
  }
  return false;
}
origin: com.atlassian.swagger/atlassian-swagger-doclet

Consumes methodConsumes = ReflectionUtils.getAnnotation(method, Consumes.class);
Consumes classConsumes = ReflectionUtils.getAnnotation(method.getDeclaringClass(), Consumes.class);
JsonView jsonViewAnnotation = ReflectionUtils.getAnnotation(method, JsonView.class);
origin: com.atlassian.swagger/atlassian-swagger-doclet

methodProduces = ReflectionUtils.getAnnotation(method, Produces.class);
classProduces = ReflectionUtils.getAnnotation(method.getDeclaringClass(), Produces.class);
origin: com.atlassian.swagger/atlassian-swagger-doclet

static void processFormParam(Parameter formParameter, Operation operation,
               MethodDoc methodDoc, Components components) {
  Option<Method> methodOpt = ReflectionKit.loadMethod(methodDoc);
  if (methodOpt.isDefined()) {
    Method method = methodOpt.get();
    Consumes methodConsumes = ReflectionUtils.getAnnotation(method, Consumes.class);
    Consumes classConsumes = ReflectionUtils.getAnnotation(method.getDeclaringClass(), Consumes.class);
    RequestBody requestBody = operation.getRequestBody() != null ? operation.getRequestBody() : new RequestBody();
    requestBody.description(formParameter.getDescription());
    if (!Strings.isNullOrEmpty(formParameter.getDescription())) {
      requestBody.setDescription(formParameter.getDescription());
    }
    Content content = processContent(requestBody.getContent(), formParameter.getSchema(),
        methodConsumes, classConsumes, true);
    requestBody.setContent(content);
    setRequestBodyExamples(formParameter, requestBody);
    operation.setRequestBody(requestBody);
  }
}
origin: io.swagger.core.v3/swagger-jaxrs2

final javax.ws.rs.Path apiPath = ReflectionUtils.getAnnotation(cls, javax.ws.rs.Path.class);
ExternalDocumentation apiExternalDocs = ReflectionUtils.getAnnotation(cls, ExternalDocumentation.class);
io.swagger.v3.oas.annotations.tags.Tag[] apiTags = ReflectionUtils.getRepeatableAnnotationsArray(cls, io.swagger.v3.oas.annotations.tags.Tag.class);
io.swagger.v3.oas.annotations.servers.Server[] apiServers = ReflectionUtils.getRepeatableAnnotationsArray(cls, io.swagger.v3.oas.annotations.servers.Server.class);
javax.ws.rs.Consumes classConsumes = ReflectionUtils.getAnnotation(cls, javax.ws.rs.Consumes.class);
javax.ws.rs.Produces classProduces = ReflectionUtils.getAnnotation(cls, javax.ws.rs.Produces.class);
OpenAPIDefinition openAPIDefinition = ReflectionUtils.getAnnotation(cls, OpenAPIDefinition.class);
  javax.ws.rs.Produces methodProduces = ReflectionUtils.getAnnotation(method, javax.ws.rs.Produces.class);
  javax.ws.rs.Consumes methodConsumes = ReflectionUtils.getAnnotation(method, javax.ws.rs.Consumes.class);
  javax.ws.rs.Path methodPath = ReflectionUtils.getAnnotation(method, javax.ws.rs.Path.class);
    io.swagger.v3.oas.annotations.Operation apiOperation = ReflectionUtils.getAnnotation(method, io.swagger.v3.oas.annotations.Operation.class);
    JsonView jsonViewAnnotation;
    JsonView jsonViewAnnotationForRequestBody;
      jsonViewAnnotationForRequestBody = null;
    } else {
      jsonViewAnnotation = ReflectionUtils.getAnnotation(method, JsonView.class);
io.swagger.v3.oas.annotations.Operation apiOperation = ReflectionUtils.getAnnotation(method, io.swagger.v3.oas.annotations.Operation.class);
List<io.swagger.v3.oas.annotations.responses.ApiResponse> apiResponses = ReflectionUtils.getRepeatableAnnotations(method, io.swagger.v3.oas.annotations.responses.ApiResponse.class);
io.swagger.v3.oas.annotations.parameters.RequestBody apiRequestBody =
    ReflectionUtils.getAnnotation(method, io.swagger.v3.oas.annotations.parameters.RequestBody.class);
origin: noboomu/proteus

final javax.ws.rs.Path apiPath = ReflectionUtils.getAnnotation(cls, javax.ws.rs.Path.class);
    .getRepeatableAnnotations(cls, io.swagger.v3.oas.annotations.security.SecurityRequirement.class);
ExternalDocumentation apiExternalDocs = ReflectionUtils.getAnnotation(cls, ExternalDocumentation.class);
io.swagger.v3.oas.annotations.tags.Tag[] apiTags = ReflectionUtils.getRepeatableAnnotationsArray(cls, io.swagger.v3.oas.annotations.tags.Tag.class);
io.swagger.v3.oas.annotations.servers.Server[] apiServers = ReflectionUtils.getRepeatableAnnotationsArray(cls, io.swagger.v3.oas.annotations.servers.Server.class);
javax.ws.rs.Consumes classConsumes = ReflectionUtils.getAnnotation(cls, javax.ws.rs.Consumes.class);
javax.ws.rs.Produces classProduces = ReflectionUtils.getAnnotation(cls, javax.ws.rs.Produces.class);
OpenAPIDefinition openAPIDefinition = ReflectionUtils.getAnnotation(cls, OpenAPIDefinition.class);
  javax.ws.rs.Produces methodProduces = ReflectionUtils.getAnnotation(method, javax.ws.rs.Produces.class);
  javax.ws.rs.Consumes methodConsumes = ReflectionUtils.getAnnotation(method, javax.ws.rs.Consumes.class);
  javax.ws.rs.Path methodPath = ReflectionUtils.getAnnotation(method, javax.ws.rs.Path.class);
    io.swagger.v3.oas.annotations.Operation apiOperation = ReflectionUtils.getAnnotation(method, io.swagger.v3.oas.annotations.Operation.class);
    JsonView jsonViewAnnotation = ReflectionUtils.getAnnotation(method, JsonView.class);
    if (apiOperation != null && apiOperation.ignoreJsonView())
io.swagger.v3.oas.annotations.Operation apiOperation = ReflectionUtils.getAnnotation(method, io.swagger.v3.oas.annotations.Operation.class);
io.swagger.v3.oas.annotations.parameters.RequestBody apiRequestBody = ReflectionUtils.getAnnotation(method, io.swagger.v3.oas.annotations.parameters.RequestBody.class);
ExternalDocumentation apiExternalDocumentation = ReflectionUtils.getAnnotation(method, ExternalDocumentation.class);
origin: com.atlassian.swagger/atlassian-swagger-doclet

Method method = methodOpt.get();
Annotation[][] paramAnnotations = ReflectionUtils.getParameterAnnotations(method);
Consumes methodConsumes = ReflectionUtils.getAnnotation(method, Consumes.class);
Consumes classConsumes = ReflectionUtils.getAnnotation(method.getDeclaringClass(), Consumes.class);
JsonView jsonViewAnnotation = ReflectionUtils.getAnnotation(method, JsonView.class);
io.swagger.v3.core.utilReflectionUtilsgetAnnotation

Javadoc

Returns an annotation by type from a method.

Popular methods of ReflectionUtils

  • getOverriddenMethod
    Returns overridden method from superclass if it exists. If method was not found returns null.
  • 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

  • Running tasks concurrently on multiple threads
  • getExternalFilesDir (Context)
  • getSupportFragmentManager (FragmentActivity)
  • getContentResolver (Context)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • JComboBox (javax.swing)
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Top Sublime Text plugins
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