lang3
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/proxy/trunk@1582545 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/core/src/main/java/org/apache/commons/proxy2/ProxyUtils.java b/core/src/main/java/org/apache/commons/proxy2/ProxyUtils.java
index dd79fe7..0f7ab79 100644
--- a/core/src/main/java/org/apache/commons/proxy2/ProxyUtils.java
+++ b/core/src/main/java/org/apache/commons/proxy2/ProxyUtils.java
@@ -20,10 +20,11 @@
import java.lang.reflect.Method;
import java.util.Collections;
import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
import java.util.Map;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.ClassUtils;
+
/**
* Provides some helpful proxy utility methods.
*
@@ -36,8 +37,8 @@
// Fields
//******************************************************************************************************************
- public static final Object[] EMPTY_ARGUMENTS = new Object[0];
- public static final Class<?>[] EMPTY_ARGUMENT_TYPES = new Class[0];
+ public static final Object[] EMPTY_ARGUMENTS = ArrayUtils.EMPTY_OBJECT_ARRAY;
+ public static final Class<?>[] EMPTY_ARGUMENT_TYPES = ArrayUtils.EMPTY_CLASS_ARRAY;
private static final Map<Class<?>, Class<?>> WRAPPER_CLASS_MAP;
private static final Map<Class<?>, Object> NULL_VALUE_MAP;
@@ -96,31 +97,7 @@
*/
public static Class<?>[] getAllInterfaces(Class<?> cls)
{
- final List<Class<?>> interfaces = getAllInterfacesImpl(cls, new LinkedList<Class<?>>());
- return interfaces == null ? null : (Class[]) interfaces.toArray(new Class[interfaces.size()]);
- }
-
- private static List<Class<?>> getAllInterfacesImpl(final Class<?> cls, List<Class<?>> list)
- {
- if (cls == null)
- {
- return null;
- }
- Class<?> currentClass = cls;
- while (currentClass != null)
- {
- Class<?>[] interfaces = currentClass.getInterfaces();
- for (int i = 0; i < interfaces.length; i++)
- {
- if (!list.contains(interfaces[i]))
- {
- list.add(interfaces[i]);
- }
- getAllInterfacesImpl(interfaces[i], list);
- }
- currentClass = currentClass.getSuperclass();
- }
- return list;
+ return cls == null ? null : ClassUtils.getAllInterfaces(cls).toArray(ArrayUtils.EMPTY_CLASS_ARRAY);
}
/**