A linker for POJOs. Normally used as the ultimate fallback linker by the {@link DynamicLinkerFactory} so it is giventhe chance to link calls to all objects that no other language runtime recognizes. Specifically, this linker will:
- expose all public methods of form {@code setXxx()}, {@code getXxx()}, and {@code isXxx()} as property setters andgetters for {@code dyn:setProp} and {@code dyn:getProp} operations;
- expose all public methods for invocation through {@code dyn:callMethod} operation;
- expose all public methods for retrieval for {@code dyn:getMethod} operation; the methods thus retrieved can thenbe invoked using {@code dyn:call};
- expose all public fields as properties, unless there are getters or setters for the properties of the same name;
- expose {@code dyn:getLength}, {@code dyn:getElem} and {@code dyn:setElem} on native Java arrays, as well as{@link java.util.List} and {@link java.util.Map} objects; ({@code dyn:getLength} works on any{@link java.util.Collection});
- expose a virtual property named {@code length} on Java arrays;
- expose {@code dyn:new} on instances of {@link StaticClass} as calls to constructors, including those static classobjects that represent Java arrays (their constructors take a single {@code int} parameter representing the length ofthe array to create);
- expose static methods, fields, and properties of classes in a similar manner to how instance method, fields, and properties are exposed, on {@link StaticClass} objects.
- expose a virtual property named {@code static} on instances of {@link java.lang.Class} to access their{@link 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. {@code 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 {@link LinkRequest}s are ignored and {@link MethodHandles#publicLookup()} is used instead.
@author Attila Szegedi