@FunctionalInterface public interface MissingMemberHandlerFactory
BeansLinker
. BeansLinker links these method handles into guarded invocations for link requests specifying GET_*
and SET_*
StandardOperation
s when it is either certain or possible that the requested member (property, method, or element) is missing. They will be linked both for named
and unnamed operations. The implementer must ensure that the parameter types of the returned method handle match the parameter types of the call site described in the link request. The return types can differ, though, to allow DynamicLinkerFactory.setPrelinkTransformer(jdk.dynalink.linker.GuardedInvocationTransformer)
late return type transformations}. It is allowed to return null
for a method handle if the default behavior is sufficient. BeansLinker
is configured without a missing member handler factory, or the factory returns null
for a particular handler creation invocation, the default behavior is used. The default behavior is to return null
from BeansLinker.getGuardedInvocation(LinkRequest, LinkerServices)
when it can be determined at link time that the linked operation will never address an existing member. This lets the DynamicLinker
attempt the next linker if there is one, or ultimately fail the link request with NoSuchDynamicMethodException
. For other cases (typically all unnamed member operations as well as most named operations on collection elements) BeansLinker
will produce a conditional linkage that will return null
when invoked at runtime with a name that does not match any member for getters and silently ignore the passed values for setters. Modifier and Type | Method | Description |
---|---|---|
MethodHandle |
createMissingMemberHandler |
Returns a method handle suitable for implementing missing member behavior for a particular link request. |
MethodHandle createMissingMemberHandler(LinkRequest linkRequest, LinkerServices linkerServices) throws Exception
linkRequest
- the current link requestlinkerServices
- the current link servicesException
- if the operation fails for any reason. Please observe the class documentation notes for implementing exception-throwing missing member behavior.
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/jdk.dynalink/jdk/dynalink/beans/MissingMemberHandlerFactory.html