Reflections { private Reflections() { } private  Reflections(); static Class<?>[] getParameterTypes(final Method m); static Class<?>[] getParameterTypes(final Constructor<?> m); static Class<?> primitiveToWrapper(final Class<?> clasz); @Nonnull static Type primitiveToWrapper(final Type type); static Class<?> wrapperToPrimitive(final Class<?> clasz); static boolean isWrappableOrWrapper(final Class clasz); static Object getAnnotationAttribute(@Nonnull final Annotation annot, @Nonnull final String attributeName); @Nullable @SuppressFBWarnings(value = "ES_COMPARING_STRINGS_WITH_EQ", justification = "comparing interned strings") static Method getDeclaredMethod(final Class<?> c,
          final String methodName,
          final Class<?>... paramTypes); @Nullable @SuppressFBWarnings(value = "ES_COMPARING_STRINGS_WITH_EQ", justification = "comparing interned strings") static Method getMethod(final Class<?> c,
          final String methodName,
          final Class<?>... paramTypes); @Nullable static Constructor<?> getConstructor(final Class<?> c, final Class<?>... paramTypes); @Nullable static Method getCompatibleMethod(final Class<?> c,
          final String methodName,
          final Class<?>... paramTypes); @Nullable static MethodHandle getCompatibleMethodHandle(final Class<?> c,
          final String methodName,
          final Class<?>... paramTypes); static Object invoke(final Method m, final Object object, final Object[] parameters); static boolean canAssign(final Class<?> to, final Class<?> from); @Nullable static Method getCompatibleMethodCached(final Class<?> c,
          final String methodName,
          final Class<?>... paramTypes); static MethodHandle getCompatibleMethodHandleCached(final Class<?> c,
          final String methodName,
          final Class<?>... paramTypes); @Nullable @SuppressFBWarnings({ "NP_LOAD_OF_KNOWN_NULL_VALUE", "URLCONNECTION_SSRF_FD" }) static Manifest getManifest(@Nonnull final URL jarUrl); static T implementStatic(final Class<T> clasz, final Class<?> target); static T implement(final Class<T> clasz, final Object target); @Nullable static Class<?> getLoadedClass(final ClassLoader cl, final String className); static Class<?> forName(final String name); static Class<?> forName(final String name, final ClassLoader loader); static List<Type> getImplementedGenericInterfaces(final Class<?> clasz); @Nullable static A getInheritedAnnotation(
          final Class<A> annotationClass, final AnnotatedElement element);  }
@Test public void testReflections() { Method reflect = Reflections.getCompatibleMethod(String.class, "indexOf", PARAMS); Method fastM = Reflections.getCompatibleMethodCached(String.class, "indexOf", PARAMS); Assert.assertEquals(reflect, fastM); Method method = Reflections.getMethod(String.class, "indexOf", int.class); Assert.assertEquals("indexOf", method.getName()); method = Reflections.getMethod(String.class, "bla", char.class); Assert.assertNull(method); Constructor cons = Reflections.getConstructor(String.class, byte[].class); Assert.assertNotNull(cons); cons = Reflections.getConstructor(String.class, Pair.class); Assert.assertNull(cons); }