com.github.datalking.common.PrioritizedParameterNameDiscoverer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of play-mvc Show documentation
Show all versions of play-mvc Show documentation
simple mvc framework based on java servlet.
The newest version!
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