//package org.nestframework.utils;
import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.Reader;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
/**
* Nest utility class.
*
* @author audin
*
*/
public class NestUtil {
/**
* Get all methods of a class.
*
* @param clazz The class.
* @return All methods of a class.
*/
public static Collection getMethods(Class> clazz) {
// if (log.isDebugEnabled()) {
// log.debug("getMethods(Class>) - start");
// }
Collection found = new ArrayList();
while (clazz != null) {
for (Method m1 : clazz.getDeclaredMethods()) {
boolean overridden = false;
for (Method m2 : found) {
if (m2.getName().equals(m1.getName())
&& Arrays.deepEquals(m1.getParameterTypes(), m2
.getParameterTypes())) {
overridden = true;
break;
}
}
if (!overridden)
found.add(m1);
}
clazz = clazz.getSuperclass();
}
//if (log.isDebugEnabled()) {
// log.debug("getMethods(Class>) - end");
// }
return found;
}
}