Codota Logo
Method.getDeclaringClass
Code IndexAdd Codota to your IDE (free)

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

Best Java code snippets using java.lang.reflect.Method.getDeclaringClass (Showing top 20 results out of 26,325)

  • Common ways to obtain Method
private void myMethod () {
Method m =
  • Codota IconClass clazz;clazz.getMethod("<changeme>")
  • Codota IconClass clazz;String name;Class[] parameterTypes;clazz.getMethod(name, parameterTypes)
  • Codota IconPropertyDescriptor pd;pd.getReadMethod()
  • Smart code suggestions by Codota
}
origin: spring-projects/spring-framework

@Override
protected boolean isCandidateForProperty(Method method, Class<?> targetClass) {
  Class<?> clazz = method.getDeclaringClass();
  return (clazz != Object.class && clazz != Class.class && !ClassLoader.class.isAssignableFrom(targetClass));
}
origin: square/retrofit

 @Override public String toString() {
  return String.format("%s.%s() %s",
    method.getDeclaringClass().getName(), method.getName(), arguments);
 }
}
origin: spring-projects/spring-framework

@Override
protected boolean isCandidateForInvocation(Method method, Class<?> targetClass) {
  if (Modifier.isStatic(method.getModifiers())) {
    return false;
  }
  Class<?> clazz = method.getDeclaringClass();
  return (clazz != Object.class && clazz != Class.class && !ClassLoader.class.isAssignableFrom(targetClass));
}
origin: square/retrofit

static RuntimeException methodError(Method method, @Nullable Throwable cause, String message,
  Object... args) {
 message = String.format(message, args);
 return new IllegalArgumentException(message
   + "\n    for method "
   + method.getDeclaringClass().getSimpleName()
   + "."
   + method.getName(), cause);
}
origin: spring-projects/spring-framework

@Nullable
protected CacheDefaults getCacheDefaults(Method method, @Nullable Class<?> targetType) {
  CacheDefaults annotation = method.getDeclaringClass().getAnnotation(CacheDefaults.class);
  if (annotation != null) {
    return annotation;
  }
  return (targetType != null ? targetType.getAnnotation(CacheDefaults.class) : null);
}
origin: spring-projects/spring-framework

  public static boolean isSetBeanFactory(Method candidateMethod) {
    return (candidateMethod.getName().equals("setBeanFactory") &&
        candidateMethod.getParameterCount() == 1 &&
        BeanFactory.class == candidateMethod.getParameterTypes()[0] &&
        BeanFactoryAware.class.isAssignableFrom(candidateMethod.getDeclaringClass()));
  }
}
origin: spring-projects/spring-framework

public CglibMethodInvocation(Object proxy, @Nullable Object target, Method method,
    Object[] arguments, @Nullable Class<?> targetClass,
    List<Object> interceptorsAndDynamicMethodMatchers, MethodProxy methodProxy) {
  super(proxy, target, method, arguments, targetClass, interceptorsAndDynamicMethodMatchers);
  // Only use method proxy for public methods not derived from java.lang.Object
  this.methodProxy = (Modifier.isPublic(method.getModifiers()) &&
      method.getDeclaringClass() != Object.class && !AopUtils.isEqualsMethod(method) &&
      !AopUtils.isHashCodeMethod(method) && !AopUtils.isToStringMethod(method) ?
      methodProxy : null);
}
origin: spring-projects/spring-framework

@Nullable
private SendTo getSendTo(Method specificMethod) {
  SendTo ann = AnnotatedElementUtils.findMergedAnnotation(specificMethod, SendTo.class);
  if (ann == null) {
    ann = AnnotatedElementUtils.findMergedAnnotation(specificMethod.getDeclaringClass(), SendTo.class);
  }
  return ann;
}
origin: spring-projects/spring-framework

@Override
@Nullable
public Collection<CacheOperation> parseCacheAnnotations(Method method) {
  DefaultCacheConfig defaultConfig = new DefaultCacheConfig(method.getDeclaringClass());
  return parseCacheAnnotations(defaultConfig, method);
}
origin: spring-projects/spring-framework

@Override
public void generateCode(MethodVisitor mv, CodeFlow cf) {
  Method method = this.method;
  Assert.state(method != null, "No method handle");
  String classDesc = method.getDeclaringClass().getName().replace('.', '/');
  generateCodeForArguments(mv, cf, method, this.children);
  mv.visitMethodInsn(INVOKESTATIC, classDesc, method.getName(),
      CodeFlow.createSignatureDescriptor(method), false);
  cf.pushDescriptor(this.exitTypeDescriptor);
}
origin: spring-projects/spring-framework

@Override
public boolean isMatch(Method candidateMethod) {
  return (candidateMethod.getDeclaringClass() != Object.class &&
      !BeanFactoryAwareMethodInterceptor.isSetBeanFactory(candidateMethod) &&
      BeanAnnotationHelper.isBeanAnnotated(candidateMethod));
}
origin: spring-projects/spring-framework

private Method getGetterFromSetter(Method setter) {
  String getterName = setter.getName().replaceFirst("set", "get");
  try {
    return setter.getDeclaringClass().getMethod(getterName);
  }
  catch (NoSuchMethodException ex) {
    // must be write only
    return null;
  }
}
origin: google/guava

/**
 * Verifies that {@code method} produces a {@link NullPointerException} or {@link
 * UnsupportedOperationException} when the parameter in position {@code paramIndex} is null. If
 * this parameter is marked nullable, this method does nothing.
 *
 * @param instance the instance to invoke {@code method} on, or null if {@code method} is static
 */
public void testMethodParameter(
  @Nullable final Object instance, final Method method, int paramIndex) {
 method.setAccessible(true);
 testParameter(instance, invokable(instance, method), paramIndex, method.getDeclaringClass());
}
origin: spring-projects/spring-framework

  @Override
  public Object invoke(MethodInvocation mi) throws Throwable {
    if (mi.getMethod().getDeclaringClass().equals(AddedGlobalInterface.class)) {
      return new Integer(-1);
    }
    return mi.proceed();
  }
}
origin: square/retrofit

 @Override public Object invoke(Object proxy, Method method, @Nullable Object[] args)
   throws Throwable {
  // If the method is a method from Object then defer to normal invocation.
  if (method.getDeclaringClass() == Object.class) {
   return method.invoke(this, args);
  }
  if (platform.isDefaultMethod(method)) {
   return platform.invokeDefaultMethod(method, service, proxy, args);
  }
  return loadServiceMethod(method).invoke(args != null ? args : emptyArgs);
 }
});
origin: ReactiveX/RxJava

static void scan(Class<?> clazz) {
  for (Method m : clazz.getMethods()) {
    if (m.getDeclaringClass() == clazz) {
      if ((m.getModifiers() & Modifier.STATIC) == 0) {
        if ((m.getModifiers() & (Modifier.PUBLIC | Modifier.FINAL)) == Modifier.PUBLIC) {
          fail("Not final: " + m);
        }
      }
    }
  }
}
origin: google/guava

private static void doTestMocking(RateLimiter mock) throws Exception {
 for (Method method : RateLimiter.class.getMethods()) {
  if (!isStatic(method.getModifiers())
    && !NOT_WORKING_ON_MOCKS.contains(method.getName())
    && !method.getDeclaringClass().equals(Object.class)) {
   method.invoke(mock, arbitraryParameters(method));
  }
 }
}
origin: spring-projects/spring-framework

  @Override
  protected void assertions(MethodInvocation invocation) {
    assertTrue(invocation.getThis() == this);
    assertTrue("Invocation should be on ITestBean: " + invocation.getMethod(),
        ITestBean.class.isAssignableFrom(invocation.getMethod().getDeclaringClass()));
  }
}
origin: spring-projects/spring-framework

  @Override
  protected void assertions(MethodInvocation invocation) {
    assertSame(this, invocation.getThis());
    assertTrue("Invocation should be on ITestBean: " + invocation.getMethod(),
      ITestBean.class.isAssignableFrom(invocation.getMethod().getDeclaringClass()));
  }
}
origin: spring-projects/spring-framework

  @Override
  protected void assertions(MethodInvocation invocation) {
    assertEquals(this, invocation.getThis());
    assertEquals("Invocation should be on ITestBean: " + invocation.getMethod(),
        ITestBean.class, invocation.getMethod().getDeclaringClass());
  }
};
java.lang.reflectMethodgetDeclaringClass

Javadoc

Returns the Class object representing the class or interface that declares the method represented by this Method object.

Popular methods of Method

  • invoke
    Returns the result of dynamically invoking this method. Equivalent to receiver.methodName(arg1, arg2
  • getName
  • getParameterTypes
  • getReturnType
  • setAccessible
  • getAnnotation
  • getModifiers
  • isAnnotationPresent
  • 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

  • Finding current android device location
  • compareTo (BigDecimal)
  • findViewById (Activity)
  • putExtra (Intent)
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • ArrayList (java.util)
    Resizable-array implementation of the List interface. Implements all optional list operations, and p
  • Stack (java.util)
    The Stack class represents a last-in-first-out (LIFO) stack of objects. It extends class Vector with
  • Timer (java.util)
    A facility for threads to schedule tasks for future execution in a background thread. Tasks may be s
  • TreeMap (java.util)
    A Red-Black tree based NavigableMap implementation. The map is sorted according to the Comparable of
  • JCheckBox (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now