package frame.object.dao; import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; public abstract class MethodPublisher { protected Map methodMap; protected Map allMethodMap; public MethodPublisher() { methodMap = new HashMap(); allMethodMap = new HashMap(); collectMethod(); publishMethod(); } public Method getMethod(String lower) { // TODO Auto-generated method stub return null; } protected void collectMethod() { Method[] methods = this.getClass().getDeclaredMethods(); for (Method one : methods) { allMethodMap.put(one.getName().toLowerCase(), one); } } protected abstract void publishMethod(); protected void addMethod(String name) { if (name == null) { return; } name = name.toLowerCase(); Method method = allMethodMap.get(name); if (method != null) { method.setAccessible(true); methodMap.put(name, method); } } public Map getMethodMap() { return methodMap; } }