public class CompositeTypeBasedGuardingDynamicLinker extends Object implements TypeBasedGuardingDynamicLinker, Serializable
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.Constructor and Description |
---|
CompositeTypeBasedGuardingDynamicLinker(Iterable<? extends TypeBasedGuardingDynamicLinker> linkers)
Creates a new composite type-based linker.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canLinkType(Class<?> type)
Returns true if the linker can link an invocation where the first argument (receiver) is of the specified type.
|
GuardedInvocation |
getGuardedInvocation(LinkRequest linkRequest,
LinkerServices linkerServices)
Creates a guarded invocation appropriate for a particular invocation with the specified arguments at a call site.
|
static List<GuardingDynamicLinker> |
optimize(Iterable<? extends GuardingDynamicLinker> linkers)
Optimizes a list of type-based linkers.
|
public CompositeTypeBasedGuardingDynamicLinker(Iterable<? extends TypeBasedGuardingDynamicLinker> linkers)
linkers
- the component linkerspublic boolean canLinkType(Class<?> type)
TypeBasedGuardingDynamicLinker
canLinkType
in interface TypeBasedGuardingDynamicLinker
type
- the type to linkpublic GuardedInvocation getGuardedInvocation(LinkRequest linkRequest, LinkerServices linkerServices) throws Exception
GuardingDynamicLinker
getGuardedInvocation
in interface GuardingDynamicLinker
linkRequest
- the object describing the request for linking a particular invocationlinkerServices
- linker servicesLinkRequest.withoutRuntimeContext()
and link for that.Exception
- if the operation fails for whatever reasonpublic static List<GuardingDynamicLinker> optimize(Iterable<? extends GuardingDynamicLinker> linkers)
TypeBasedGuardingDynamicLinker
, they will be replaced with a single instance of
CompositeTypeBasedGuardingDynamicLinker
that contains them.linkers
- the list of linkers to optimizeCopyright © 2019 Attila Szegedi. All rights reserved.