1 16 17 package org.springframework.core; 18 19 import java.lang.reflect.Constructor ; 20 import java.lang.reflect.Method ; 21 import java.util.Iterator ; 22 import java.util.LinkedList ; 23 import java.util.List ; 24 25 37 public class PrioritizedParameterNameDiscoverer implements ParameterNameDiscoverer { 38 39 private final List parameterNameDiscoverers = new LinkedList (); 40 41 42 46 public void addDiscoverer(ParameterNameDiscoverer pnd) { 47 this.parameterNameDiscoverers.add(pnd); 48 } 49 50 51 public String [] getParameterNames(Method method) { 52 for (Iterator it = this.parameterNameDiscoverers.iterator(); it.hasNext(); ) { 53 ParameterNameDiscoverer pnd = (ParameterNameDiscoverer) it.next(); 54 String [] result = pnd.getParameterNames(method); 55 if (result != null) { 56 return result; 57 } 58 } 59 return null; 60 } 61 62 public String [] getParameterNames(Constructor ctor) { 63 for (Iterator it = this.parameterNameDiscoverers.iterator(); it.hasNext(); ) { 64 ParameterNameDiscoverer pnd = (ParameterNameDiscoverer) it.next(); 65 String [] result = pnd.getParameterNames(ctor); 66 if (result != null) { 67 return result; 68 } 69 } 70 return null; 71 } 72 73 } 74 | Popular Tags |