public class BeansLinker extends Object implements GuardingDynamicLinker
DynamicLinkerFactory so it is given
the chance to link calls to all objects that no other language runtime recognizes. Specifically, this linker will:
setXxx(), getXxx(), and isXxx() as property setters and
getters for dyn:setProp and dyn:getProp operations;BeanInfo;BeanInfo for invocation through
dyn:callMethod operation;BeanInfo for retrieval for
dyn:getMethod operation; the methods thus retrieved can then be invoked using dyn:call;dyn:getLength, dyn:getElem and dyn:setElem on native Java arrays, as well as
List and Map objects; (dyn:getLength works on any
Collection);length on Java arrays;dyn:new on instances of StaticClass as calls to constructors, including those static class
objects that represent Java arrays (their constructors take a single int parameter representing the length of
the array to create);StaticClass objects.static on instances of Class to access their
StaticClass.Overloaded method resolution is performed automatically for property setters, methods, and
constructors. Additionally, manual overloaded method selection is supported by having a call site specify a name for
a method that contains an explicit signature, i.e. dyn:getMethod:parseInt(String,int). You can use
non-qualified class names in such signatures regardless of those classes' packages, they will match any class with
the same non-qualified name. You only have to use a fully qualified class name in case non-qualified class names
would cause selection ambiguity (that is extremely rare).
Variable argument invocation is handled for both methods and constructors.
Currently, only public fields and methods are supported. Any Lookup objects passed in the
LinkRequests are ignored and MethodHandles.publicLookup() is used instead.
| Constructor and Description |
|---|
BeansLinker()
Creates a new POJO linker.
|
| Modifier and Type | Method and Description |
|---|---|
GuardedInvocation |
getGuardedInvocation(LinkRequest request,
LinkerServices linkerServices)
Creates a guarded invocation appropriate for a particular invocation with the specified arguments at a call site.
|
static TypeBasedGuardingDynamicLinker |
getLinkerForClass(Class<?> clazz)
Returns a bean linker for a particular single class.
|
public static TypeBasedGuardingDynamicLinker getLinkerForClass(Class<?> clazz)
clazz - the classpublic GuardedInvocation getGuardedInvocation(LinkRequest request, LinkerServices linkerServices) throws Exception
GuardingDynamicLinkergetGuardedInvocation in interface GuardingDynamicLinkerrequest - the object describing the request for linking a particular invocationlinkerServices - linker servicesLinkRequest.withoutRuntimeContext() and link for that.Exception - if the operation fails for whatever reasonCopyright © 2013 Attila Szegedi. All Rights Reserved.