public class RuntimeMethods extends Object
| Constructor and Description |
|---|
RuntimeMethods() |
| Modifier and Type | Method and Description |
|---|---|
static Object |
assignStructuralIdentity(Object obj,
Class iface) |
static Object |
coerce(Object value,
Class<?> type) |
static Object |
constructProxy(Object root,
Class iface) |
static Object |
invokeUnhandled(Object thiz,
Class proxiedIface,
String name,
Class returnType,
Class[] paramTypes,
Object[] args)
Facilitates ICallHandler where the receiver of the method call structurally implements a method,
but the association of the structural interface with the receiver is lost.
|
public static Object invokeUnhandled(Object thiz, Class proxiedIface, String name, Class returnType, Class[] paramTypes, Object[] args)
Person person = Person.create(); // Person is a JsonTypeManifold interface; the runtime type of person here is really just a Map (or Binding) IMyStructureThing thing = (IMyStructureThing)person; // Extension method[s] satisfying IMyStructureThing on Person make this work e.g., via MyPersonExt extension methods class thing.foo(); // foo() is an extension method on Person e.g., defined in MyPersonExt, however the runtime type of thing is just a Map (or Binding) thus the Person type identity is lost
Copyright © 2018. All rights reserved.