commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1166253 - in /commons/proper/lang/trunk/src: main/java/org/apache/commons/lang3/reflect/MethodUtils.java site/changes/changes.xml test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java
Date Wed, 07 Sep 2011 16:27:43 GMT
Author: ggregory
Date: Wed Sep  7 16:27:42 2011
New Revision: 1166253

URL: http://svn.apache.org/viewvc?rev=1166253&view=rev
Log:
Revert changes from r1166233: [LANG-750] Add MethodUtil APIs to call methods without parameters.

Modified:
    commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java
    commons/proper/lang/trunk/src/site/changes/changes.xml
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java

Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java?rev=1166253&r1=1166252&r2=1166253&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java
(original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java
Wed Sep  7 16:27:42 2011
@@ -59,33 +59,6 @@ public class MethodUtils {
     }
 
     /**
-     * <p>Invokes a named method without parameters.</p>
-     *
-     * <p>This method delegates the method search to {@link #getMatchingAccessibleMethod(Class,
String, Class[])}.</p>
-     *
-     * <p>This method supports calls to methods taking primitive parameters 
-     * via passing in wrapping classes. So, for example, a <code>Boolean</code>
object
-     * would match a <code>boolean</code> primitive.</p>
-     *
-     * <p>This is a convenient wrapper for
-     * {@link #invokeMethod(Object object,String methodName, Object[] args, Class[] parameterTypes)}.
-     * </p>
-     *
-     * @param object invoke method on this object
-     * @param methodName get method with this name
-     * @return The value returned by the invoked method
-     *
-     * @throws NoSuchMethodException if there is no such accessible method
-     * @throws InvocationTargetException wraps an exception thrown by the method invoked
-     * @throws IllegalAccessException if the requested method is not accessible via reflection
-     * @since 3.0.2
-     */
-    public static Object invokeMethod(Object object, String methodName) throws NoSuchMethodException,
-            IllegalAccessException, InvocationTargetException {
-        return invokeMethod(object, methodName, ArrayUtils.EMPTY_OBJECT_ARRAY);
-    }
-
-    /**
      * <p>Invokes a named method whose parameter type matches the object type.</p>
      *
      * <p>This method delegates the method search to {@link #getMatchingAccessibleMethod(Class,
String, Class[])}.</p>
@@ -161,28 +134,6 @@ public class MethodUtils {
     }
 
     /**
-     * <p>Invokes a method without parameters.</p>
-     *
-     * <p>This uses reflection to invoke the method obtained from a call to
-     * <code>getAccessibleMethod()</code>.</p>
-     *
-     * @param object invoke method on this object
-     * @param methodName get method with this name
-     * @return The value returned by the invoked method
-     *
-     * @throws NoSuchMethodException if there is no such accessible method
-     * @throws InvocationTargetException wraps an exception thrown by the
-     *  method invoked
-     * @throws IllegalAccessException if the requested method is not accessible
-     *  via reflection
-     * @since 3.0.2
-     */
-    public static Object invokeExactMethod(Object object, String methodName) throws NoSuchMethodException,
-            IllegalAccessException, InvocationTargetException {
-        return invokeExactMethod(object, methodName, ArrayUtils.EMPTY_OBJECT_ARRAY);
-    }
-
-    /**
      * <p>Invokes a method whose parameter types match exactly the object
      * types.</p>
      *
@@ -291,35 +242,6 @@ public class MethodUtils {
     }
 
     /**
-     * <p>Invokes a named static method without parameters.</p>
-     *
-     * <p>This method delegates the method search to {@link #getMatchingAccessibleMethod(Class,
String, Class[])}.</p>
-     *
-     * <p>This method supports calls to methods taking primitive parameters 
-     * via passing in wrapping classes. So, for example, a <code>Boolean</code>
class
-     * would match a <code>boolean</code> primitive.</p>
-     *
-     * <p>This is a convenient wrapper for
-     * {@link #invokeStaticMethod(Class objectClass,String methodName,Object [] args,Class[]
parameterTypes)}.
-     * </p>
-     *
-     * @param cls invoke static method on this class
-     * @param methodName get method with this name
-     * @return The value returned by the invoked method
-     *
-     * @throws NoSuchMethodException if there is no such accessible method
-     * @throws InvocationTargetException wraps an exception thrown by the
-     *  method invoked
-     * @throws IllegalAccessException if the requested method is not accessible
-     *  via reflection
-     * @since 3.0.2
-     */
-    public static Object invokeStaticMethod(Class<?> cls, String methodName) throws
NoSuchMethodException,
-            IllegalAccessException, InvocationTargetException {
-        return invokeStaticMethod(cls, methodName, ArrayUtils.EMPTY_OBJECT_ARRAY);
-    }
-
-    /**
      * <p>Invokes a named static method whose parameter type matches the object type.</p>
      *
      * <p>This method delegates the method search to {@link #getMatchingAccessibleMethod(Class,
String, Class[])}.</p>
@@ -399,28 +321,6 @@ public class MethodUtils {
     }
 
     /**
-     * <p>Invokes a static method without parameters.</p>
-     *
-     * <p>This uses reflection to invoke the method obtained from a call to
-     * {@link #getAccessibleMethod(Class, String, Class[])}.</p>
-     *
-     * @param cls invoke static method on this class
-     * @param methodName get method with this name
-     * @return The value returned by the invoked method
-     *
-     * @throws NoSuchMethodException if there is no such accessible method
-     * @throws InvocationTargetException wraps an exception thrown by the
-     *  method invoked
-     * @throws IllegalAccessException if the requested method is not accessible
-     *  via reflection
-     * @since 3.0.2
-     */
-    public static Object invokeExactStaticMethod(Class<?> cls, String methodName) throws
NoSuchMethodException,
-            IllegalAccessException, InvocationTargetException {
-        return invokeExactStaticMethod(cls, methodName, ArrayUtils.EMPTY_OBJECT_ARRAY);
-    }
-
-    /**
      * <p>Invokes a static method whose parameter types match exactly the object
      * types.</p>
      *

Modified: commons/proper/lang/trunk/src/site/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/site/changes/changes.xml?rev=1166253&r1=1166252&r2=1166253&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/site/changes/changes.xml (original)
+++ commons/proper/lang/trunk/src/site/changes/changes.xml Wed Sep  7 16:27:42 2011
@@ -22,7 +22,6 @@
   <body>
 
   <release version="3.0.2" date="unreleased" description="September release">  
-    <action type="add" issue="LANG-750">Add MethodUtil APIs to call methods without
parameters</action>
     <action type="fix" issue="LANG-746">NumberUtils does not handle upper-case hex:
0X and -0X</action>
     <action type="update" issue="LANG-736">CharUtils static final array CHAR_STRING
is not needed to compute CHAR_STRING_ARRAY</action>
     <action type="fix" issue="LANG-744">StringUtils throws java.security.AccessControlException
on Google App Engine</action>

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java?rev=1166253&r1=1166252&r2=1166253&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java
(original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java
Wed Sep  7 16:27:42 2011
@@ -162,16 +162,6 @@ public class MethodUtilsTest {
     }
 
     @Test
-    public void testInvokeMethodNoParam() throws Exception {
-        assertEquals("foo()", MethodUtils.invokeMethod(testBean, "foo"));
-    }
-
-    @Test(expected = NoSuchMethodException.class)
-    public void testInvokeMethodNoParamFailure() throws Exception {
-        assertEquals("oneParameter()", MethodUtils.invokeMethod(testBean, "oneParameter"));
-    }
-
-    @Test
     public void testInvokeExactMethod() throws Exception {
         assertEquals("foo()", MethodUtils.invokeExactMethod(testBean, "foo",
                 (Object[]) ArrayUtils.EMPTY_CLASS_ARRAY));
@@ -209,16 +199,6 @@ public class MethodUtilsTest {
     }
 
     @Test
-    public void testInvokeExactMethodNoParam() throws Exception {
-        assertEquals("foo()", MethodUtils.invokeExactMethod(testBean, "foo"));
-    }
-
-    @Test(expected = NoSuchMethodException.class)
-    public void testInvokeExactMethodNoParamFailure() throws Exception {
-        MethodUtils.invokeExactMethod(testBean, "oneParameter");
-    }
-
-    @Test
     public void testInvokeStaticMethod() throws Exception {
         assertEquals("bar()", MethodUtils.invokeStaticMethod(TestBean.class,
                 "bar", (Object[]) ArrayUtils.EMPTY_CLASS_ARRAY));
@@ -249,16 +229,6 @@ public class MethodUtilsTest {
     }
 
     @Test
-    public void testInvokeStaticMethodNoParam() throws Exception {
-        assertEquals("bar()", MethodUtils.invokeStaticMethod(TestBean.class, "bar"));
-    }
-
-    @Test(expected = NoSuchMethodException.class)
-    public void testInvokeStaticMethodNoParamFailure() throws Exception {
-        assertEquals("oneParameter()", MethodUtils.invokeStaticMethod(TestBean.class, "oneParameter"));
-    }
-
-    @Test
     public void testInvokeExactStaticMethod() throws Exception {
         assertEquals("bar()", MethodUtils.invokeExactStaticMethod(TestBean.class,
                 "bar", (Object[]) ArrayUtils.EMPTY_CLASS_ARRAY));
@@ -297,16 +267,6 @@ public class MethodUtilsTest {
     }
 
     @Test
-    public void testInvokeExactStaticMethodNoParam() throws Exception {
-        assertEquals("bar()", MethodUtils.invokeExactStaticMethod(TestBean.class, "bar"));
-    }
-
-    @Test(expected = NoSuchMethodException.class)
-    public void testInvokeExactStaticMethodNoParamFailure() throws Exception {
-        assertEquals("oneParameterStatic()", MethodUtils.invokeExactStaticMethod(TestBean.class,
"oneParameterStatic"));
-    }
-
-    @Test
     public void testGetAccessibleInterfaceMethod() throws Exception {
         Class<?>[][] p = { ArrayUtils.EMPTY_CLASS_ARRAY, null };
         for (Class<?>[] element : p) {



Mime
View raw message