Created
July 13, 2018 10:33
-
-
Save cshijiel/a8239473569f52f5d41ff9adc0387f2a to your computer and use it in GitHub Desktop.
ParameterNameProvider
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static class ClearParameterNameProvider implements ParameterNameProvider { | |
private static ParameterNameDiscoverer discoverer = new LocalVariableTableParameterNameDiscoverer(); | |
private static ParameterNameProvider provider = new DefaultParameterNameProvider(); | |
@Override | |
public List<String> getParameterNames(Constructor<?> constructor) { | |
String[] parameterNames = discoverer.getParameterNames(constructor); | |
return Optional.ofNullable(parameterNames).map(Arrays::asList).orElse(provider.getParameterNames(constructor)); | |
} | |
@Override | |
public List<String> getParameterNames(Method method) { | |
String[] parameterNames = discoverer.getParameterNames(method); | |
return Optional.ofNullable(parameterNames).map(Arrays::asList).orElse(provider.getParameterNames(method)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment