Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

BoundaryInterfaceReflectionUtil

open class BoundaryInterfaceReflectionUtil
kotlin.Any
   ↳ org.chromium.support_lib_boundary.util.BoundaryInterfaceReflectionUtil

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

Summary

Public constructors

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

Public methods
open static T
castToSuppLibClass(clazz: Class<T>!, invocationHandler: InvocationHandler!)

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

open static Boolean
containsFeature(features: Array<String!>!, soughtFeature: String!)

Check whether a set of features {@param features} contains a certain feature {@param * soughtFeature}.

open static InvocationHandler!

Create an java.lang.reflect.InvocationHandler that delegates method calls to {@param delegate}, making sure that the java.lang.reflect.Method and parameters being passed to {@param delegate} exist in the same java.lang.ClassLoader as {@param * delegate}.

open static Method!
dupeMethod(method: Method!, delegateLoader: ClassLoader!)

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

open static Any!

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.

Public constructors

<init>

BoundaryInterfaceReflectionUtil()

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

Public methods

castToSuppLibClass

open static fun <T : Any!> castToSuppLibClass(clazz: Class<T>!, invocationHandler: InvocationHandler!): T

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

containsFeature

open static fun containsFeature(features: Array<String!>!, soughtFeature: String!): Boolean

Check whether a set of features {@param features} contains a certain feature {@param * soughtFeature}.

createInvocationHandlerFor

open static fun createInvocationHandlerFor(delegate: Any!): InvocationHandler!

Create an java.lang.reflect.InvocationHandler that delegates method calls to {@param delegate}, making sure that the java.lang.reflect.Method and parameters being passed to {@param delegate} exist in the same java.lang.ClassLoader as {@param * delegate}.

dupeMethod

open static fun dupeMethod(method: Method!, delegateLoader: ClassLoader!): Method!

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

getDelegateFromInvocationHandler

open static fun getDelegateFromInvocationHandler(invocationHandler: InvocationHandler!): Any!

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.