Package one.nio.util

Class MethodHandlesReflection


  • public class MethodHandlesReflection
    extends java.lang.Object
    Allows to lookup information about available Class' methods using java.lang.invoke API, when the standard getDeclaredMethods() fail with NoClassDefFoundError due to some missing class file. All lookups are made recursively through parent classes.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.invoke.MethodHandles.Lookup privateLookup  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.invoke.MethodHandleInfo findInstanceMethod​(java.lang.Class<?> cls, java.lang.String name, java.lang.invoke.MethodType type)  
      static java.lang.invoke.MethodHandleInfo findInstanceMethodOrThrow​(java.lang.Class<?> cls, java.lang.String name, java.lang.invoke.MethodType type)  
      static java.lang.invoke.MethodHandleInfo findStaticMethod​(java.lang.Class<?> cls, java.lang.String name, java.lang.invoke.MethodType type)  
      static java.lang.invoke.MethodHandleInfo findStaticMethodOrThrow​(java.lang.Class<?> cls, java.lang.String name, java.lang.invoke.MethodType type)  
      private static java.lang.invoke.MethodHandles.Lookup getPrivateLookup()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • privateLookup

        public static final java.lang.invoke.MethodHandles.Lookup privateLookup
    • Constructor Detail

      • MethodHandlesReflection

        public MethodHandlesReflection()
    • Method Detail

      • getPrivateLookup

        private static java.lang.invoke.MethodHandles.Lookup getPrivateLookup()
      • findInstanceMethod

        public static java.lang.invoke.MethodHandleInfo findInstanceMethod​(java.lang.Class<?> cls,
                                                                           java.lang.String name,
                                                                           java.lang.invoke.MethodType type)
      • findInstanceMethodOrThrow

        public static java.lang.invoke.MethodHandleInfo findInstanceMethodOrThrow​(java.lang.Class<?> cls,
                                                                                  java.lang.String name,
                                                                                  java.lang.invoke.MethodType type)
                                                                           throws java.lang.NoSuchMethodException,
                                                                                  java.lang.IllegalAccessException
        Throws:
        java.lang.NoSuchMethodException
        java.lang.IllegalAccessException
      • findStaticMethod

        public static java.lang.invoke.MethodHandleInfo findStaticMethod​(java.lang.Class<?> cls,
                                                                         java.lang.String name,
                                                                         java.lang.invoke.MethodType type)
      • findStaticMethodOrThrow

        public static java.lang.invoke.MethodHandleInfo findStaticMethodOrThrow​(java.lang.Class<?> cls,
                                                                                java.lang.String name,
                                                                                java.lang.invoke.MethodType type)
                                                                         throws java.lang.NoSuchMethodException,
                                                                                java.lang.IllegalAccessException
        Throws:
        java.lang.NoSuchMethodException
        java.lang.IllegalAccessException