Skip navigation links
JNA API 5.6.0
com.sun.jna.internal

Class ReflectionUtils

    • Constructor Summary

      Constructors 
      Constructor and Description
      ReflectionUtils() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static java.lang.Object getMethodHandle(java.lang.reflect.Method method)
      Retrieve the method handle, that can be used to invoke the provided method.
      static java.lang.Object invokeDefaultMethod(java.lang.Object target, java.lang.Object methodHandle, java.lang.Object... args)
      Invokes a default method reflectively.
      static boolean isDefault(java.lang.reflect.Method method)
      Check if the supplied method object represents a default method.
      • Methods inherited from class java.lang.Object

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

      • ReflectionUtils

        public ReflectionUtils()
    • Method Detail

      • isDefault

        public static boolean isDefault(java.lang.reflect.Method method)
        Check if the supplied method object represents a default method.

        This is the reflective equivalent of method.isDefault().

        Parameters:
        method -
        Returns:
        true if JVM supports default methods and method is a default method
      • getMethodHandle

        public static java.lang.Object getMethodHandle(java.lang.reflect.Method method)
                                                throws java.lang.Exception
        Retrieve the method handle, that can be used to invoke the provided method. It is only intended to be used to call default methods on interfaces.
        Parameters:
        method -
        Returns:
        method handle that can be used to invoke the supplied method
        Throws:
        java.lang.Exception
      • invokeDefaultMethod

        public static java.lang.Object invokeDefaultMethod(java.lang.Object target,
                                                           java.lang.Object methodHandle,
                                                           java.lang.Object... args)
                                                    throws java.lang.Throwable
        Invokes a default method reflectively. The method must be called with the method handle for a default method on an interfaces.
        Parameters:
        target - object to invoke the supplied method handle on
        methodHandle - retrieved via getMethodHandle(java.lang.reflect.Method)
        args -
        Returns:
        result of the invokation
        Throws:
        java.lang.Throwable
JNA API 5.6.0

Copyright © 2007-2018 Timothy Wall. All Rights Reserved.