Tabnine Logo
Class.isAnnotationPresent
Code IndexAdd Tabnine to your IDE (free)

How to use
isAnnotationPresent
method
in
java.lang.Class

Best Java code snippets using java.lang.Class.isAnnotationPresent (Showing top 20 results out of 16,137)

origin: spring-projects/spring-framework

/**
 * Create a new {@link AnnotationTypeFilter} for the given annotation type.
 * @param annotationType the annotation type to match
 * @param considerMetaAnnotations whether to also match on meta-annotations
 * @param considerInterfaces whether to also match interfaces
 */
public AnnotationTypeFilter(
    Class<? extends Annotation> annotationType, boolean considerMetaAnnotations, boolean considerInterfaces) {
  super(annotationType.isAnnotationPresent(Inherited.class), considerInterfaces);
  this.annotationType = annotationType;
  this.considerMetaAnnotations = considerMetaAnnotations;
}
origin: apache/incubator-dubbo

private static <T> boolean withExtensionAnnotation(Class<T> type) {
  return type.isAnnotationPresent(SPI.class);
}
origin: apache/incubator-dubbo

private static <T> boolean withExtensionAnnotation(Class<T> type) {
  return type.isAnnotationPresent(SPI.class);
}
origin: libgdx/libgdx

/** Returns true if the supplied class includes an annotation of the given type. */
static public boolean isAnnotationPresent (Class c, Class<? extends java.lang.annotation.Annotation> annotationType) {
  return c.isAnnotationPresent(annotationType);
}
origin: libgdx/libgdx

/** Returns true if the supplied class includes an annotation of the given type. */
static public boolean isAnnotationPresent (Class c, Class<? extends java.lang.annotation.Annotation> annotationType) {
  return c.isAnnotationPresent(annotationType);
}
origin: spring-projects/spring-framework

/**
 * Checks whether the given annotation type is a recognized qualifier type.
 */
protected boolean isQualifier(Class<? extends Annotation> annotationType) {
  for (Class<? extends Annotation> qualifierType : this.qualifierTypes) {
    if (annotationType.equals(qualifierType) || annotationType.isAnnotationPresent(qualifierType)) {
      return true;
    }
  }
  return false;
}
origin: apache/incubator-dubbo

private static boolean hasConstraintParameter(Method method) {
  Annotation[][] parameterAnnotations = method.getParameterAnnotations();
  if (parameterAnnotations != null && parameterAnnotations.length > 0) {
    for (Annotation[] annotations : parameterAnnotations) {
      for (Annotation annotation : annotations) {
        if (annotation.annotationType().isAnnotationPresent(Constraint.class)) {
          return true;
        }
      }
    }
  }
  return false;
}
origin: apache/incubator-dubbo

private static boolean hasConstraintParameter(Method method) {
  Annotation[][] parameterAnnotations = method.getParameterAnnotations();
  if (parameterAnnotations != null && parameterAnnotations.length > 0) {
    for (Annotation[] annotations : parameterAnnotations) {
      for (Annotation annotation : annotations) {
        if (annotation.annotationType().isAnnotationPresent(Constraint.class)) {
          return true;
        }
      }
    }
  }
  return false;
}
origin: spring-projects/spring-framework

@Override
public boolean canRead(Class<?> clazz, @Nullable MediaType mediaType) {
  return (clazz.isAnnotationPresent(XmlRootElement.class) || clazz.isAnnotationPresent(XmlType.class)) &&
      canRead(mediaType);
}
origin: square/retrofit

 private static Set<? extends Annotation> jsonAnnotations(Annotation[] annotations) {
  Set<Annotation> result = null;
  for (Annotation annotation : annotations) {
   if (annotation.annotationType().isAnnotationPresent(JsonQualifier.class)) {
    if (result == null) result = new LinkedHashSet<>();
    result.add(annotation);
   }
  }
  return result != null ? unmodifiableSet(result) : Collections.<Annotation>emptySet();
 }
}
origin: spring-projects/spring-framework

@Override
public boolean canEncode(ResolvableType elementType, @Nullable MimeType mimeType) {
  if (super.canEncode(elementType, mimeType)) {
    Class<?> outputClass = elementType.toClass();
    return (outputClass.isAnnotationPresent(XmlRootElement.class) ||
        outputClass.isAnnotationPresent(XmlType.class));
  }
  else {
    return false;
  }
}
origin: spring-projects/spring-framework

@Override
public boolean canDecode(ResolvableType elementType, @Nullable MimeType mimeType) {
  Class<?> outputClass = elementType.toClass();
  return (outputClass.isAnnotationPresent(XmlRootElement.class) ||
      outputClass.isAnnotationPresent(XmlType.class)) && super.canDecode(elementType, mimeType);
}
origin: spring-projects/spring-framework

@Override
public boolean matches(Class<?> clazz) {
  return (this.checkInherited ? AnnotatedElementUtils.hasAnnotation(clazz, this.annotationType) :
      clazz.isAnnotationPresent(this.annotationType));
}
origin: square/retrofit

@Override public @Nullable Converter<ResponseBody, ?> responseBodyConverter(
  Type type, Annotation[] annotations, Retrofit retrofit) {
 if (type instanceof Class && ((Class<?>) type).isAnnotationPresent(XmlRootElement.class)) {
  return new JaxbResponseConverter<>(contextForType((Class<?>) type), (Class<?>) type);
 }
 return null;
}
origin: square/retrofit

@Override public @Nullable Converter<?, RequestBody> requestBodyConverter(Type type,
  Annotation[] parameterAnnotations, Annotation[] methodAnnotations, Retrofit retrofit) {
 if (type instanceof Class && ((Class<?>) type).isAnnotationPresent(XmlRootElement.class)) {
  return new JaxbRequestConverter<>(contextForType((Class<?>) type), (Class<?>) type);
 }
 return null;
}
origin: alibaba/fastjson

public boolean supports(MethodParameter returnType, Class<? extends HttpMessageConverter<?>> converterType) {
  return FastJsonHttpMessageConverter.class.isAssignableFrom(converterType)
      &&
      (returnType.getContainingClass().isAnnotationPresent(ResponseJSONP.class) || returnType.hasMethodAnnotation(ResponseJSONP.class));
}
origin: apache/incubator-dubbo

@Override
public <T> T getExtension(Class<T> type, String name) {
  if (type.isInterface() && type.isAnnotationPresent(SPI.class)) {
    ExtensionLoader<T> loader = ExtensionLoader.getExtensionLoader(type);
    if (!loader.getSupportedExtensions().isEmpty()) {
      return loader.getAdaptiveExtension();
    }
  }
  return null;
}
origin: apache/incubator-dubbo

@Override
public <T> T getExtension(Class<T> type, String name) {
  if (type.isInterface() && type.isAnnotationPresent(SPI.class)) {
    ExtensionLoader<T> loader = ExtensionLoader.getExtensionLoader(type);
    if (!loader.getSupportedExtensions().isEmpty()) {
      return loader.getAdaptiveExtension();
    }
  }
  return null;
}
origin: spring-projects/spring-framework

private Object unmarshal(List<XMLEvent> events, Class<?> outputClass) {
  try {
    Unmarshaller unmarshaller = initUnmarshaller(outputClass);
    XMLEventReader eventReader = StaxUtils.createXMLEventReader(events);
    if (outputClass.isAnnotationPresent(XmlRootElement.class)) {
      return unmarshaller.unmarshal(eventReader);
    }
    else {
      JAXBElement<?> jaxbElement = unmarshaller.unmarshal(eventReader, outputClass);
      return jaxbElement.getValue();
    }
  }
  catch (UnmarshalException ex) {
    throw new DecodingException("Could not unmarshal XML to " + outputClass, ex);
  }
  catch (JAXBException ex) {
    throw new CodecException("Invalid JAXB configuration", ex);
  }
}
origin: spring-projects/spring-framework

@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
  if (isLogEnabled()) {
    String[] beanNames = beanFactory.getBeanDefinitionNames();
    for (String beanName : beanNames) {
      String nameToLookup = beanName;
      if (beanFactory.isFactoryBean(beanName)) {
        nameToLookup = BeanFactory.FACTORY_BEAN_PREFIX + beanName;
      }
      Class<?> beanType = beanFactory.getType(nameToLookup);
      if (beanType != null) {
        Class<?> userClass = ClassUtils.getUserClass(beanType);
        if (userClass.isAnnotationPresent(Deprecated.class)) {
          BeanDefinition beanDefinition = beanFactory.getBeanDefinition(beanName);
          logDeprecatedBean(beanName, beanType, beanDefinition);
        }
      }
    }
  }
}
java.langClassisAnnotationPresent

Popular methods of Class

  • getName
    Returns the name of the class represented by this Class. For a description of the format which is us
  • getSimpleName
  • getClassLoader
  • isAssignableFrom
    Determines if the class or interface represented by this Class object is either the same as, or is a
  • forName
    Returns the Class object associated with the class or interface with the given string name, using th
  • newInstance
    Returns a new instance of the class represented by this Class, created by invoking the default (that
  • getMethod
    Returns a Method object that reflects the specified public member method of the class or interface r
  • getResourceAsStream
    Finds a resource with a given name. The rules for searching resources associated with a given class
  • getSuperclass
    Returns the Class representing the superclass of the entity (class, interface, primitive type or voi
  • getConstructor
  • cast
    Casts an object to the class or interface represented by this Class object.
  • isInstance
  • cast,
  • isInstance,
  • getCanonicalName,
  • getDeclaredField,
  • isArray,
  • getAnnotation,
  • getDeclaredFields,
  • getResource,
  • getDeclaredMethod,
  • getMethods

Popular in Java

  • Parsing JSON documents to java classes using gson
  • setRequestProperty (URLConnection)
  • setScale (BigDecimal)
  • getResourceAsStream (ClassLoader)
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • Collectors (java.util.stream)
  • CodeWhisperer alternatives
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