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

How to use
getMethods
method
in
java.lang.Class

Best Java code snippets using java.lang.Class.getMethods (Showing top 20 results out of 32,319)

origin: spring-projects/spring-framework

/**
 * Return the set of methods for this type. The default implementation returns the
 * result of {@link Class#getMethods()} for the given {@code type}, but subclasses
 * may override in order to alter the results, e.g. specifying static methods
 * declared elsewhere.
 * @param type the class for which to return the methods
 * @since 3.1.1
 */
protected Method[] getMethods(Class<?> type) {
  return type.getMethods();
}
origin: spring-projects/spring-framework

/**
 * Return class methods ordered with non-bridge methods appearing higher.
 */
private Method[] getSortedMethods(Class<?> clazz) {
  return this.sortedMethodsCache.computeIfAbsent(clazz, key -> {
    Method[] methods = key.getMethods();
    Arrays.sort(methods, (o1, o2) -> (o1.isBridge() == o2.isBridge() ? 0 : (o1.isBridge() ? 1 : -1)));
    return methods;
  });
}
origin: google/guava

/** Returns the most concrete public methods from {@code type}. */
private static Method[] getMostConcreteMethods(Class<?> type) {
 Method[] methods = type.getMethods();
 for (int i = 0; i < methods.length; i++) {
  try {
   methods[i] = type.getMethod(methods[i].getName(), methods[i].getParameterTypes());
  } catch (Exception e) {
   throwIfUnchecked(e);
   throw new RuntimeException(e);
  }
 }
 return methods;
}
origin: google/guava

private static Set<Method> findInterruptibleMethods(Class<?> interfaceType) {
 Set<Method> set = Sets.newHashSet();
 for (Method m : interfaceType.getMethods()) {
  if (declaresInterruptedEx(m)) {
   set.add(m);
  }
 }
 return set;
}
origin: spring-projects/spring-framework

/**
 * Return whether the given bean class declares or inherits any non-void
 * returning bean property or indexed property setter methods.
 */
private boolean supports(Class<?> beanClass) {
  for (Method method : beanClass.getMethods()) {
    if (ExtendedBeanInfo.isCandidateWriteMethod(method)) {
      return true;
    }
  }
  return false;
}
origin: spring-projects/spring-framework

@Nullable
private Method findDestroyMethod(String name) {
  return (this.nonPublicAccessAllowed ?
      BeanUtils.findMethodWithMinimalParameters(this.bean.getClass(), name) :
      BeanUtils.findMethodWithMinimalParameters(this.bean.getClass().getMethods(), name));
}
origin: spring-projects/spring-framework

private static Method findMethodWithReturnType(String name, Class<?> returnType, Class<SettingsDaoImpl> targetType) {
  Method[] methods = targetType.getMethods();
  for (Method m : methods) {
    if (m.getName().equals(name) && m.getReturnType().equals(returnType)) {
      return m;
    }
  }
  return null;
}
origin: spring-projects/spring-framework

private static Method getMethodForReturnType(Class<?> returnType) {
  return Arrays.stream(TestBean.class.getMethods())
      .filter(method -> method.getReturnType().equals(returnType))
      .findFirst()
      .orElseThrow(() ->
          new IllegalArgumentException("Unique return type not found: " + returnType));
}
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: google/guava

@GwtIncompatible // reflection
public void testAsMapBridgeMethods() {
 for (Method m : TreeMultimap.class.getMethods()) {
  if (m.getName().equals("asMap") && m.getReturnType().equals(SortedMap.class)) {
   return;
  }
 }
}
origin: google/guava

public void testReentrantReadWriteLock_implDoesNotExposeShadowedLocks() {
 assertEquals(
   "Unexpected number of public methods in ReentrantReadWriteLock. "
     + "The correctness of CycleDetectingReentrantReadWriteLock depends on "
     + "the fact that the shadowed ReadLock and WriteLock are never used or "
     + "exposed by the superclass implementation. If the implementation has "
     + "changed, the code must be re-inspected to ensure that the "
     + "assumption is still valid.",
   24,
   ReentrantReadWriteLock.class.getMethods().length);
}
origin: spring-projects/spring-framework

protected Method getMethod(String name) {
  // Assumes no overloading of test methods...
  Method[] candidates = getClass().getMethods();
  for (Method candidate : candidates) {
    if (candidate.getName().equals(name)) {
      return candidate;
    }
  }
  fail("Bad test specification, no method '" + name + "' found in test class");
  return null;
}
origin: spring-projects/spring-framework

@Before
public void setup() throws NoSuchMethodException {
  getAge = TestBean.class.getMethod("getAge");
  // Assumes no overloading
  for (Method method : HasGeneric.class.getMethods()) {
    methodsOnHasGeneric.put(method.getName(), method);
  }
}
origin: google/guava

@GwtIncompatible // reflection
public void testKeySetBridgeMethods() {
 for (Method m : TreeMultimap.class.getMethods()) {
  if (m.getName().equals("keySet") && m.getReturnType().equals(SortedSet.class)) {
   return;
  }
 }
 fail("No bridge method found");
}
origin: google/guava

 @GwtIncompatible // reflection
 public void testGetBridgeMethods() {
  for (Method m : TreeMultimap.class.getMethods()) {
   if (m.getName().equals("get") && m.getReturnType().equals(SortedSet.class)) {
    return;
   }
  }
  fail("No bridge method found");
 }
}
origin: google/guava

 @GwtIncompatible // reflection
 @AndroidIncompatible // Reflection bug, or actual binary compatibility problem?
 public void testElementSetBridgeMethods() {
  for (Method m : TreeMultiset.class.getMethods()) {
   if (m.getName().equals("elementSet") && m.getReturnType().equals(SortedSet.class)) {
    return;
   }
  }
  fail("No bridge method found");
 }
}
origin: spring-projects/spring-framework

@Test
public void testOnAllMethods() throws Exception {
  Method[] methods = StringList.class.getMethods();
  for (Method method : methods) {
    assertNotNull(BridgeMethodResolver.findBridgedMethod(method));
  }
}
origin: spring-projects/spring-framework

@Before
public void setUp() throws Exception {
  this.comparator = new AspectJPrecedenceComparator();
  this.anyOldMethod = getClass().getMethods()[0];
  this.anyOldPointcut = new AspectJExpressionPointcut();
  this.anyOldPointcut.setExpression("execution(* *(..))");
}
origin: google/guava

public static TestSuite suite() {
 TestSuite suite = new TestSuite();
 Method[] methods = Monitor.class.getMethods();
 sortMethods(methods);
 for (Method method : methods) {
  if (isAnyEnter(method) || isWaitFor(method)) {
   validateMethod(method);
   addTests(suite, method);
  }
 }
 assertEquals(548, suite.testCount());
 return suite;
}
java.langClassgetMethods

Javadoc

Returns an array containing Method objects for all public methods for the class C represented by this Class. Methods may be declared in C, the interfaces it implements or in the superclasses of C. The elements in the returned array are in no particular order.

If there are no public methods or if this Class represents a primitive type or void then an empty array is returned.

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

Popular in Java

  • Making http post requests using okhttp
  • scheduleAtFixedRate (Timer)
  • notifyDataSetChanged (ArrayAdapter)
  • getSharedPreferences (Context)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • Socket (java.net)
    Provides a client-side TCP socket.
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • JFileChooser (javax.swing)
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • Best IntelliJ 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