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

How to use
isAnnotationPresent
method
in
java.lang.reflect.Method

Best Java code snippets using java.lang.reflect.Method.isAnnotationPresent (Showing top 20 results out of 12,546)

origin: libgdx/libgdx

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

/** Returns true if the method includes an annotation of the provided class type. */
public boolean isAnnotationPresent (Class<? extends java.lang.annotation.Annotation> annotationType) {
  return method.isAnnotationPresent(annotationType);
}
origin: mrniko/netty-socketio

  @Override
  public boolean matches(Method method) {
    for (Class<? extends Annotation> annotationClass : annotations) {
      if (method.isAnnotationPresent(annotationClass)) {
        return true;
      }
    }
    return false;
  }
});
origin: org.mockito/mockito-core

  public static boolean hasTestMethods(Class<?> klass) {
    Method[] methods = klass.getMethods();
    for(Method m:methods) {
      if (m.isAnnotationPresent(Test.class)) {
        return true;
      }
    }
    return false;
  }
}
origin: google/j2objc

  public boolean hasTestMethods(Class<?> klass) {
    Method[] methods = klass.getMethods();
    for(Method m:methods) {
      if (m.isAnnotationPresent(Test.class)) {
        return true;
      }
    }
    return false;
  }
}
origin: spring-projects/spring-framework

private boolean matchesMethod(Method method) {
  return (this.checkInherited ? AnnotatedElementUtils.hasAnnotation(method, this.annotationType) :
      method.isAnnotationPresent(this.annotationType));
}
origin: lets-blade/blade

private static void cacheMethod(Map<Class<? extends Annotation>, Method> cache, Method[] methods, Class<? extends Annotation> filter) {
  List<Method> methodList = Stream.of(methods)
      .filter(method -> method.isAnnotationPresent(filter))
      .collect(Collectors.toList());
  if (methodList.size() == 1) {
    cache.put(filter, methodList.get(0));
  } else if (methodList.size() > 1) {
    throw new RuntimeException("Duplicate annotation @" + filter.getSimpleName() + " in class: " + methodList.get(0).getDeclaringClass().getName());
  }
}
origin: lets-blade/blade

private static void cacheMethod(Map<Class<? extends Annotation>, Method> cache, Method[] methods, Class<? extends Annotation> filter) {
  List<Method> methodList = Stream.of(methods)
      .filter(method -> method.isAnnotationPresent(filter))
      .collect(Collectors.toList());
  if (methodList.size() == 1) {
    cache.put(filter, methodList.get(0));
  } else if (methodList.size() > 1) {
    throw new RuntimeException("Duplicate annotation @" + filter.getSimpleName() + " in class: " + methodList.get(0).getDeclaringClass().getName());
  }
}
origin: neo4j/neo4j

private String description( Method method )
{
  if ( method.isAnnotationPresent( Description.class ) )
  {
    return method.getAnnotation( Description.class ).value();
  }
  else
  {
    return null;
  }
}
origin: google/guava

private static ImmutableList<Method> getAnnotatedMethodsNotCached(Class<?> clazz) {
 Set<? extends Class<?>> supertypes = TypeToken.of(clazz).getTypes().rawTypes();
 Map<MethodIdentifier, Method> identifiers = Maps.newHashMap();
 for (Class<?> supertype : supertypes) {
  for (Method method : supertype.getDeclaredMethods()) {
   if (method.isAnnotationPresent(Subscribe.class) && !method.isSynthetic()) {
    // TODO(cgdecker): Should check for a generic parameter type and error out
    Class<?>[] parameterTypes = method.getParameterTypes();
    checkArgument(
      parameterTypes.length == 1,
      "Method %s has @Subscribe annotation but has %s parameters."
        + "Subscriber methods must have exactly 1 parameter.",
      method,
      parameterTypes.length);
    MethodIdentifier ident = new MethodIdentifier(method);
    if (!identifiers.containsKey(ident)) {
     identifiers.put(ident, method);
    }
   }
  }
 }
 return ImmutableList.copyOf(identifiers.values());
}
origin: spring-projects/spring-framework

private LifecycleMetadata buildLifecycleMetadata(final Class<?> clazz) {
  List<LifecycleElement> initMethods = new ArrayList<>();
  List<LifecycleElement> destroyMethods = new ArrayList<>();
  Class<?> targetClass = clazz;
  do {
    final List<LifecycleElement> currInitMethods = new ArrayList<>();
    final List<LifecycleElement> currDestroyMethods = new ArrayList<>();
    ReflectionUtils.doWithLocalMethods(targetClass, method -> {
      if (this.initAnnotationType != null && method.isAnnotationPresent(this.initAnnotationType)) {
        LifecycleElement element = new LifecycleElement(method);
        currInitMethods.add(element);
        if (logger.isTraceEnabled()) {
          logger.trace("Found init method on class [" + clazz.getName() + "]: " + method);
        }
      }
      if (this.destroyAnnotationType != null && method.isAnnotationPresent(this.destroyAnnotationType)) {
        currDestroyMethods.add(new LifecycleElement(method));
        if (logger.isTraceEnabled()) {
          logger.trace("Found destroy method on class [" + clazz.getName() + "]: " + method);
        }
      }
    });
    initMethods.addAll(0, currInitMethods);
    destroyMethods.addAll(currDestroyMethods);
    targetClass = targetClass.getSuperclass();
  }
  while (targetClass != null && targetClass != Object.class);
  return new LifecycleMetadata(clazz, initMethods, destroyMethods);
}
origin: apache/incubator-dubbo

Method method = clazz.getMethod(methodName, parameterTypes);
Class<?>[] methodClasses = null;
if (method.isAnnotationPresent(MethodValidated.class)){
  methodClasses = method.getAnnotation(MethodValidated.class).value();
  groups.addAll(Arrays.asList(methodClasses));
origin: apache/incubator-dubbo

Method method = clazz.getMethod(methodName, parameterTypes);
Class<?>[] methodClasses = null;
if (method.isAnnotationPresent(MethodValidated.class)){
  methodClasses = method.getAnnotation(MethodValidated.class).value();
  groups.addAll(Arrays.asList(methodClasses));
origin: Graylog2/graylog2-server

  @Override
  public void configure(ResourceInfo resourceInfo, FeatureContext context) {
    final Class<?> resourceClass = resourceInfo.getResourceClass();
    final Method resourceMethod = resourceInfo.getResourceMethod();

    if (serverStatus.hasCapability(ServerStatus.Capability.MASTER))
      return;

    if (resourceMethod.isAnnotationPresent(RestrictToMaster.class) || resourceClass.isAnnotationPresent(RestrictToMaster.class)) {
      context.register(restrictToMasterFilter);
    }
  }
}
origin: google/guava

final void testAllDeclarations() throws Exception {
 checkState(method == null);
 Method[] methods = getClass().getMethods();
 Arrays.sort(
   methods,
   new Comparator<Method>() {
    @Override
    public int compare(Method a, Method b) {
     return a.getName().compareTo(b.getName());
    }
   });
 for (Method method : methods) {
  if (method.isAnnotationPresent(TestSubtype.class)) {
   method.setAccessible(true);
   SubtypeTester tester = (SubtypeTester) clone();
   tester.method = method;
   method.invoke(tester, new Object[] {null});
  }
 }
}
origin: spring-projects/spring-framework

/**
 * Return {@code true} if {@link Ignore @Ignore} is present for the supplied
 * {@linkplain FrameworkMethod test method} or if the test method is disabled
 * via {@code @IfProfileValue}.
 * @see ProfileValueUtils#isTestEnabledInThisEnvironment(Method, Class)
 */
protected boolean isTestMethodIgnored(FrameworkMethod frameworkMethod) {
  Method method = frameworkMethod.getMethod();
  return (method.isAnnotationPresent(Ignore.class) ||
      !ProfileValueUtils.isTestEnabledInThisEnvironment(method, getTestClass().getJavaClass()));
}
origin: square/dagger

public ReflectiveProvidesBinding(Method method, String key, String moduleClass,
  Object instance, boolean library) {
 super(key, method.isAnnotationPresent(Singleton.class), moduleClass, method.getName());
 this.method = method;
 this.instance = instance;
 method.setAccessible(true);
 setLibrary(library);
}
origin: ReactiveX/RxJava

boolean isAnnotationPresent = m.isAnnotationPresent(CheckReturnValue.class);
origin: ReactiveX/RxJava

if (!m.isAnnotationPresent(SchedulerSupport.class)) {
  b.append("Missing @SchedulerSupport: ").append(m).append("\r\n");
} else {
origin: ben-manes/caffeine

/** Checks the statistics if {@link CheckNoStats} is found. */
private static void checkNoStats(ITestResult testResult, CacheContext context) {
 Method testMethod = testResult.getMethod().getConstructorOrMethod().getMethod();
 boolean checkNoStats = testMethod.isAnnotationPresent(CheckNoStats.class);
 if (!checkNoStats) {
  return;
 }
 assertThat("Test requires CacheContext param for validation", context, is(not(nullValue())));
 assertThat(context, hasHitCount(0));
 assertThat(context, hasMissCount(0));
 assertThat(context, hasLoadSuccessCount(0));
 assertThat(context, hasLoadFailureCount(0));
}
java.lang.reflectMethodisAnnotationPresent

Popular methods of Method

  • invoke
    Returns the result of dynamically invoking this method. Equivalent to receiver.methodName(arg1, arg2
  • getName
  • getParameterTypes
  • getReturnType
  • setAccessible
  • getDeclaringClass
  • getAnnotation
  • getModifiers
  • getGenericReturnType
    Returns the return type of this method as a Type instance.
  • getParameterAnnotations
  • getGenericParameterTypes
    Returns the parameter types as an array of Type instances, in declaration order. If this method has
  • isAccessible
  • getGenericParameterTypes,
  • isAccessible,
  • equals,
  • getAnnotations,
  • toString,
  • getExceptionTypes,
  • getParameterCount,
  • isBridge,
  • isSynthetic

Popular in Java

  • Creating JSON documents from java classes using gson
  • startActivity (Activity)
  • getContentResolver (Context)
  • putExtra (Intent)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • JTable (javax.swing)
  • Join (org.hibernate.mapping)
  • 21 Best IntelliJ Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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