BoundaryInterfaceReflectionUtil

public class BoundaryInterfaceReflectionUtil
extends Object

java.lang.Object
   ↳ org.chromium.support_lib_boundary.util.BoundaryInterfaceReflectionUtil


A set of utility methods used for calling across the support library boundary.

Summary

Public constructors

BoundaryInterfaceReflectionUtil()

Public methods

static <T> T castToSuppLibClass(Class<T> clazz, InvocationHandler invocationHandler)

Returns an implementation of the boundary interface named clazz, by delegating method calls to the InvocationHandler invocationHandler.

static boolean containsFeature(String[] features, String soughtFeature)

Check whether a set of features contains a certain feature .

static InvocationHandler createInvocationHandlerFor(Object delegate)

Create an InvocationHandler that delegates method calls to , making sure that the Method and parameters being passed to exist in the same ClassLoader as .

static Method dupeMethod(Method method, ClassLoader delegateLoader)

Utility method for fetching a method from , with the same signature (package + class + method name + parameters) as a given method defined in another classloader.

static Object getDelegateFromInvocationHandler(InvocationHandler invocationHandler)

Assuming that the given InvocationHandler was created in the current classloader and is an InvocationHandlerWithDelegateGetter, return the object the InvocationHandler delegates its method calls to.

Inherited methods

Public constructors

BoundaryInterfaceReflectionUtil

public BoundaryInterfaceReflectionUtil ()

Public methods

castToSuppLibClass

public static T castToSuppLibClass (Class<T> clazz, 
                InvocationHandler invocationHandler)

Returns an implementation of the boundary interface named clazz, by delegating method calls to the InvocationHandler invocationHandler.

Parameters
clazz Class

invocationHandler InvocationHandler

Returns
T

containsFeature

public static boolean containsFeature (String[] features, 
                String soughtFeature)

Check whether a set of features contains a certain feature .

Returns
boolean

createInvocationHandlerFor

public static InvocationHandler createInvocationHandlerFor (Object delegate)

Create an InvocationHandler that delegates method calls to , making sure that the Method and parameters being passed to exist in the same ClassLoader as .

Returns
InvocationHandler

dupeMethod

public static Method dupeMethod (Method method, 
                ClassLoader delegateLoader)

Utility method for fetching a method from , with the same signature (package + class + method name + parameters) as a given method defined in another classloader.

Parameters
method Method

Returns
Method

Throws
ClassNotFoundException
NoSuchMethodException

getDelegateFromInvocationHandler

public static Object getDelegateFromInvocationHandler (InvocationHandler invocationHandler)

Assuming that the given InvocationHandler was created in the current classloader and is an InvocationHandlerWithDelegateGetter, return the object the InvocationHandler delegates its method calls to.

Parameters
invocationHandler InvocationHandler

Returns
Object