1 54 package org.logicalcobwebs.cglib.core; 55 56 import java.lang.reflect.Method ; 57 import java.util.*; 58 59 public class MethodWrapper { 60 private static final MethodWrapperKey KEY_FACTORY = 61 (MethodWrapperKey)KeyFactory.create(MethodWrapperKey.class, KeyFactory.CLASS_BY_NAME); 62 63 interface MethodWrapperKey { 64 public Object newInstance(String name, Class [] parameterTypes, Class returnType); 65 } 66 67 private MethodWrapper() { 68 } 69 70 public static Object create(Method method) { 71 return KEY_FACTORY.newInstance(method.getName(), 72 method.getParameterTypes(), 73 method.getReturnType()); 74 } 75 76 public static Set createSet(Collection methods) { 77 Set set = new HashSet(); 78 for (Iterator it = methods.iterator(); it.hasNext();) { 79 set.add(create((Method )it.next())); 80 } 81 return set; 82 } 83 } 84 | Popular Tags |