Created
April 16, 2014 16:24
-
-
Save luan-cestari/10902418 to your computer and use it in GitHub Desktop.
Testing parameter getName (for bug/enhancement)
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
import java.util.Map; | |
import java.util.function.Function; | |
import java.lang.reflect.Parameter; | |
import java.lang.reflect.Method; | |
import java.util.HashMap; | |
import java.util.TreeMap; | |
import java.util.Date; | |
public class TestLampda { | |
public static void main(String[] args) { | |
Function<Object, Object> f = Key -> "Value"; | |
final Method m; | |
try { | |
m = f.getClass().getDeclaredMethod("apply", Object.class); | |
} catch (NoSuchMethodException nsme ) { throw new RuntimeException(nsme); } | |
final Parameter p = m.getParameters()[0]; | |
final String key = p.getName(); | |
System.out.println(key); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment