Class CompositeTypeBasedGuardingDynamicLinker
- java.lang.Object
-
- jdk.dynalink.linker.support.CompositeTypeBasedGuardingDynamicLinker
- All Implemented Interfaces:
-
GuardingDynamicLinker
,TypeBasedGuardingDynamicLinker
public class CompositeTypeBasedGuardingDynamicLinker extends Object implements TypeBasedGuardingDynamicLinker
A composite type-based guarding dynamic linker. When a receiver of a not yet seen class is encountered, all linkers are queried sequentially on their TypeBasedGuardingDynamicLinker.canLinkType(Class)
method. The linkers returning true are then bound to the class, and next time a receiver of same type is encountered, the linking is delegated to those linkers only, speeding up dispatch.
Constructors
Constructor | Description |
---|---|
CompositeTypeBasedGuardingDynamicLinker(Iterable<? extends TypeBasedGuardingDynamicLinker> linkers) | Creates a new composite type-based linker. |
Methods
Modifier and Type | Method | Description |
---|---|---|
boolean | canLinkType(Class<?> type) | Returns true if at least one of the composite linkers returns true from |
static List<GuardingDynamicLinker> | optimize(Iterable<? extends GuardingDynamicLinker> linkers) | Optimizes a list of type-based linkers. |
Methods declared in class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods declared in interface jdk.dynalink.linker.GuardingDynamicLinker
getGuardedInvocation
Constructors
CompositeTypeBasedGuardingDynamicLinker
public CompositeTypeBasedGuardingDynamicLinker(Iterable<? extends TypeBasedGuardingDynamicLinker> linkers)
Creates a new composite type-based linker.
- Parameters:
-
linkers
- the component linkers - Throws:
-
NullPointerException
- iflinkers
or any of its elements are null.
Methods
canLinkType
public boolean canLinkType(Class<?> type)
Returns true if at least one of the composite linkers returns true from TypeBasedGuardingDynamicLinker.canLinkType(Class)
for the type.
- Specified by:
-
canLinkType
in interfaceTypeBasedGuardingDynamicLinker
- Parameters:
-
type
- the type to link - Returns:
- true true if at least one of the composite linkers returns true from
TypeBasedGuardingDynamicLinker.canLinkType(Class)
, false otherwise.
optimize
public static List<GuardingDynamicLinker> optimize(Iterable<? extends GuardingDynamicLinker> linkers)
Optimizes a list of type-based linkers. If a group of adjacent linkers in the list all implement TypeBasedGuardingDynamicLinker
, they will be replaced with a single instance of CompositeTypeBasedGuardingDynamicLinker
that contains them.
- Parameters:
-
linkers
- the list of linkers to optimize - Returns:
- the optimized list
- Throws:
-
NullPointerException
- iflinkers
or any of its elements are null.
© 1993, 2020, 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/11/docs/api/jdk.dynalink/jdk/dynalink/linker/support/CompositeTypeBasedGuardingDynamicLinker.html