com.github.datalking.common.PrioritizedParameterNameDiscoverer Maven / Gradle / Ivy
package com.github.datalking.common;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.LinkedList;
import java.util.List;
/**
* @author yaoo on 4/19/18
*/
public class PrioritizedParameterNameDiscoverer implements ParameterNameDiscoverer {
private final List parameterNameDiscoverers = new LinkedList<>();
public void addDiscoverer(ParameterNameDiscoverer pnd) {
this.parameterNameDiscoverers.add(pnd);
}
@Override
public String[] getParameterNames(Method method) {
for (ParameterNameDiscoverer pnd : this.parameterNameDiscoverers) {
String[] result = pnd.getParameterNames(method);
if (result != null) {
return result;
}
}
return null;
}
@Override
public String[] getParameterNames(Constructor> ctor) {
for (ParameterNameDiscoverer pnd : this.parameterNameDiscoverers) {
String[] result = pnd.getParameterNames(ctor);
if (result != null) {
return result;
}
}
return null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy