Module jdk.dynalink

Class BeansLinker

java.lang.Object
jdk.dynalink.beans.BeansLinker
All Implemented Interfaces:
GuardingDynamicLinker

public class BeansLinker extends Object implements GuardingDynamicLinker
A linker for ordinary Java objects. Normally used as the ultimate fallback linker by the DynamicLinkerFactory so it is given the chance to link calls to all objects that no other linker recognized. Specifically, this linker will:

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, e.g. StandardOperation.GET.withNamespace(METHOD).named("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). Overloaded resolution for constructors is not automatic as there is no logical place to attach that functionality to but if a language wishes to provide this functionality, it can use getConstructorMethod(Class, String) as a useful building block for it.

Variable argument invocation is handled for both methods and constructors.

Caller sensitive methods can be linked as long as they are otherwise public and link requests have call site descriptors carrying full-strength MethodHandles.Lookup objects and not weakened lookups or the public lookup.

The behavior for handling missing members can be customized by passing a MissingMemberHandlerFactory to the constructor.

The class also exposes various methods for discovery of available property and method names on classes and class instances, as well as access to per-class linkers using the getLinkerForClass(Class) method.

Since:
9