public class CallSiteDescriptor extends SecureLookupSupplier
MethodHandles.Lookup
object on the caller
class in which the call site occurs, the dynamic operation at the call
site, and the method type of the call site. CallSiteDescriptor
objects are used in Dynalink to capture and store these parameters for
subsequent use by the DynamicLinker
.
The constructors of built-in RelinkableCallSite
implementations all
take a call site descriptor.
Call site descriptors must be immutable. You can use this class as-is or you can subclass it, especially if you need to add further information to the descriptors (typically, values passed in additional parameters to the bootstrap method. Since the descriptors must be immutable, you can set up a cache for equivalent descriptors to have the call sites share them.
The class extends SecureLookupSupplier
for security-checked access to
the MethodHandles.Lookup
object it carries. This lookup should be used
to find method handles to set as targets of the call site described by this
descriptor.
GET_LOOKUP_PERMISSION_NAME
Constructor and Description |
---|
CallSiteDescriptor(MethodHandles.Lookup lookup,
Operation operation,
MethodType methodType)
Creates a new call site descriptor.
|
Modifier and Type | Method and Description |
---|---|
CallSiteDescriptor |
changeMethodType(MethodType newMethodType)
Creates a new call site descriptor from this descriptor, which is
identical to this, except it changes the method type.
|
protected CallSiteDescriptor |
changeMethodTypeInternal(MethodType newMethodType)
Creates a new call site descriptor from this descriptor, which is
identical to this, except it changes the method type.
|
boolean |
equals(Object obj)
Returns true if this call site descriptor is equal to the passed object.
|
MethodType |
getMethodType()
The type of the method at the call site.
|
Operation |
getOperation()
Returns the operation at the call site.
|
int |
hashCode()
Returns a value-based hash code of this call site descriptor computed
from its operation, method type, and lookup object's lookup class and
lookup modes.
|
String |
toString()
Returns the string representation of this call site descriptor, of the
format
name(parameterTypes)returnType@lookup . |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getLookup, getLookupPrivileged
public CallSiteDescriptor(MethodHandles.Lookup lookup, Operation operation, MethodType methodType)
lookup
- the lookup object describing the class the call site belongs to.
When creating descriptors from a java.lang.invoke
bootstrap method,
it should be the lookup passed to the bootstrap.operation
- the dynamic operation at the call site.methodType
- the method type of the call site. When creating
descriptors from a java.lang.invoke
bootstrap method, it should be
the method type passed to the bootstrap.public final Operation getOperation()
public final MethodType getMethodType()
public final CallSiteDescriptor changeMethodType(MethodType newMethodType)
changeMethodTypeInternal(MethodType)
and checks that it returns
a descriptor of the same class as this descriptor.newMethodType
- the new method typeRuntimeException
- if changeMethodTypeInternal(MethodType)
returned a descriptor of different class than this object.NullPointerException
- if changeMethodTypeInternal(MethodType)
returned null.protected CallSiteDescriptor changeMethodTypeInternal(MethodType newMethodType)
newMethodType
- the new method typepublic boolean equals(Object obj)
MethodHandles.Lookup.lookupClass()
and
MethodHandles.Lookup.lookupModes()
.equals
in class Object
obj
- the reference object with which to compare.true
if this object is the same as the obj
argument; false
otherwise.Object.hashCode()
,
HashMap
public int hashCode()
hashCode
in class Object
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
Copyright © 2015, 2016, Oracle and/or its affiliates. All rights reserved.
DRAFT 9-Ubuntu+0-9b134-2