@Test public void testIsImmutable() throws Exception { ArrayList<Object> params = new ArrayList<Object>(); params.add("hello"); Clazz clazz = new Clazz(); Assert.assertTrue(Utils.isImmutableMethod(clazz.getClass(), "immutable", params)); }
public static boolean isImmutableMethod( Class<?> clazz, String methodName, ArrayList<Object> params) { if (clazz == null) { throw new NullPointerException("Class not specified"); } if (methodName == null || methodName.trim().isEmpty()) { throw new IllegalArgumentException("method name not specified"); } Class[] paramTypes = new Class[params.size()]; for (int i = 0; i < params.size(); i++) { paramTypes[i] = params.get(i).getClass(); } try { Method method = clazz.getMethod(methodName, paramTypes); return method.getDeclaredAnnotation(Immutable.class) != null; } catch (NoSuchMethodException e) { throw new IllegalStateException( String.format( "unable to find method %s in %s with param types %s", methodName, clazz, paramTypes), e); } }
Utils { public static boolean isImmutableMethod( Class<?> clazz, String methodName, ArrayList<Object> params) { if (clazz == null) { throw new NullPointerException("Class not specified"); } if (methodName == null || methodName.trim().isEmpty()) { throw new IllegalArgumentException("method name not specified"); } Class[] paramTypes = new Class[params.size()]; for (int i = 0; i < params.size(); i++) { paramTypes[i] = params.get(i).getClass(); } try { Method method = clazz.getMethod(methodName, paramTypes); return method.getDeclaredAnnotation(Immutable.class) != null; } catch (NoSuchMethodException e) { throw new IllegalStateException( String.format( "unable to find method %s in %s with param types %s", methodName, clazz, paramTypes), e); } } }
Utils { public static boolean isImmutableMethod( Class<?> clazz, String methodName, ArrayList<Object> params) { if (clazz == null) { throw new NullPointerException("Class not specified"); } if (methodName == null || methodName.trim().isEmpty()) { throw new IllegalArgumentException("method name not specified"); } Class[] paramTypes = new Class[params.size()]; for (int i = 0; i < params.size(); i++) { paramTypes[i] = params.get(i).getClass(); } try { Method method = clazz.getMethod(methodName, paramTypes); return method.getDeclaredAnnotation(Immutable.class) != null; } catch (NoSuchMethodException e) { throw new IllegalStateException( String.format( "unable to find method %s in %s with param types %s", methodName, clazz, paramTypes), e); } } private  Utils(); }
Utils { public static boolean isImmutableMethod( Class<?> clazz, String methodName, ArrayList<Object> params) { if (clazz == null) { throw new NullPointerException("Class not specified"); } if (methodName == null || methodName.trim().isEmpty()) { throw new IllegalArgumentException("method name not specified"); } Class[] paramTypes = new Class[params.size()]; for (int i = 0; i < params.size(); i++) { paramTypes[i] = params.get(i).getClass(); } try { Method method = clazz.getMethod(methodName, paramTypes); return method.getDeclaredAnnotation(Immutable.class) != null; } catch (NoSuchMethodException e) { throw new IllegalStateException( String.format( "unable to find method %s in %s with param types %s", methodName, clazz, paramTypes), e); } } private  Utils(); static final Runnable RunnerWrapper(final Runnable runnable); static final byte[] toBytes(Object object); static Object toObject(byte[] bytes); static boolean isImmutableMethod(
            Class<?> clazz, String methodName, ArrayList<Object> params); static boolean isImmutableMethod(Method method); static A getAnnotation(
            Annotation[] annotations, Class<A> annotationType); static Map<String, PolicyConfig> toPolicyConfig(Annotation[] annotations); static Map<String, Map<String, PolicyConfig>> fromDMSpecListToConfigMap(
            List<DMSpec> dmSpecList); static Map<String, PolicyConfig> fromDMSpecListToFlatConfigMap(List<DMSpec> dmSpecList); static Context getGraalContext(Language language, String microServicePath); }
Utils { public static boolean isImmutableMethod( Class<?> clazz, String methodName, ArrayList<Object> params) { if (clazz == null) { throw new NullPointerException("Class not specified"); } if (methodName == null || methodName.trim().isEmpty()) { throw new IllegalArgumentException("method name not specified"); } Class[] paramTypes = new Class[params.size()]; for (int i = 0; i < params.size(); i++) { paramTypes[i] = params.get(i).getClass(); } try { Method method = clazz.getMethod(methodName, paramTypes); return method.getDeclaredAnnotation(Immutable.class) != null; } catch (NoSuchMethodException e) { throw new IllegalStateException( String.format( "unable to find method %s in %s with param types %s", methodName, clazz, paramTypes), e); } } private  Utils(); static final Runnable RunnerWrapper(final Runnable runnable); static final byte[] toBytes(Object object); static Object toObject(byte[] bytes); static boolean isImmutableMethod(
            Class<?> clazz, String methodName, ArrayList<Object> params); static boolean isImmutableMethod(Method method); static A getAnnotation(
            Annotation[] annotations, Class<A> annotationType); static Map<String, PolicyConfig> toPolicyConfig(Annotation[] annotations); static Map<String, Map<String, PolicyConfig>> fromDMSpecListToConfigMap(
            List<DMSpec> dmSpecList); static Map<String, PolicyConfig> fromDMSpecListToFlatConfigMap(List<DMSpec> dmSpecList); static Context getGraalContext(Language language, String microServicePath);  }