public class Lookup extends Object
| Modifier and Type | Field and Description |
|---|---|
static Lookup |
PUBLIC
A canonical Lookup object that wraps
MethodHandles.publicLookup(). |
| Constructor and Description |
|---|
Lookup(java.lang.invoke.MethodHandles.Lookup lookup)
Creates a new instance, bound to an instance of
MethodHandles.Lookup. |
| Modifier and Type | Method and Description |
|---|---|
java.lang.invoke.MethodHandle |
findGetter(Class<?> refc,
String name,
Class<?> type)
Performs a
MethodHandles.Lookup.findGetter(Class, String, Class), converting any
encountered IllegalAccessException into an IllegalAccessError and NoSuchFieldException
into a NoSuchFieldError. |
static java.lang.invoke.MethodHandle |
findOwnSpecial(java.lang.invoke.MethodHandles.Lookup lookup,
String name,
Class<?> rtype,
Class<?>... ptypes)
Given a lookup, finds using
findSpecial(Class, String, MethodType) a method on that lookup's class. |
java.lang.invoke.MethodHandle |
findOwnSpecial(String name,
Class<?> rtype,
Class<?>... ptypes)
Finds using
findSpecial(Class, String, MethodType) a method on that lookup's class. |
static java.lang.invoke.MethodHandle |
findOwnStatic(java.lang.invoke.MethodHandles.Lookup lookup,
String name,
Class<?> rtype,
Class<?>... ptypes)
Given a lookup, finds using
findStatic(Class, String, MethodType) a method on that lookup's class. |
java.lang.invoke.MethodHandle |
findOwnStatic(String name,
Class<?> rtype,
Class<?>... ptypes)
Finds using
findStatic(Class, String, MethodType) a method on that lookup's class. |
java.lang.invoke.MethodHandle |
findSpecial(Class<?> declaringClass,
String name,
java.lang.invoke.MethodType type)
Performs a findSpecial on the underlying lookup, except for the backport where it rather uses unreflect.
|
java.lang.invoke.MethodHandle |
findStatic(Class<?> declaringClass,
String name,
java.lang.invoke.MethodType type)
Performs a findStatic on the underlying lookup.
|
java.lang.invoke.MethodHandle |
findVirtual(Class<?> declaringClass,
String name,
java.lang.invoke.MethodType type)
Performs a findVirtual on the underlying lookup.
|
java.lang.invoke.MethodHandle |
unreflect(Method m)
Performs a
MethodHandles.Lookup.unreflect(Method), converting any encountered
IllegalAccessException into an IllegalAccessError. |
java.lang.invoke.MethodHandle |
unreflectConstructor(Constructor<?> c)
Performs a
MethodHandles.Lookup.unreflectConstructor(Constructor), converting any
encountered IllegalAccessException into an IllegalAccessError. |
java.lang.invoke.MethodHandle |
unreflectGetter(Field f)
Performs a
MethodHandles.Lookup.unreflectGetter(Field), converting any encountered
IllegalAccessException into an IllegalAccessError. |
java.lang.invoke.MethodHandle |
unreflectSetter(Field f)
Performs a
MethodHandles.Lookup.unreflectSetter(Field), converting any encountered
IllegalAccessException into an IllegalAccessError. |
public static final Lookup PUBLIC
MethodHandles.publicLookup().public Lookup(java.lang.invoke.MethodHandles.Lookup lookup)
MethodHandles.Lookup.lookup - the MethodHandles.Lookup it delegates to.public java.lang.invoke.MethodHandle unreflect(Method m)
MethodHandles.Lookup.unreflect(Method), converting any encountered
IllegalAccessException into an IllegalAccessError.m - the method to unreflectpublic java.lang.invoke.MethodHandle unreflectGetter(Field f)
MethodHandles.Lookup.unreflectGetter(Field), converting any encountered
IllegalAccessException into an IllegalAccessError.f - the field for which a getter is unreflectedpublic java.lang.invoke.MethodHandle findGetter(Class<?> refc, String name, Class<?> type)
MethodHandles.Lookup.findGetter(Class, String, Class), converting any
encountered IllegalAccessException into an IllegalAccessError and NoSuchFieldException
into a NoSuchFieldError.refc - the class declaring the fieldname - the name of the fieldtype - the type of the fieldIllegalAccessError - if the field is inaccessible.NoSuchFieldError - if the field does not exist.public java.lang.invoke.MethodHandle unreflectSetter(Field f)
MethodHandles.Lookup.unreflectSetter(Field), converting any encountered
IllegalAccessException into an IllegalAccessError.f - the field for which a setter is unreflectedpublic java.lang.invoke.MethodHandle unreflectConstructor(Constructor<?> c)
MethodHandles.Lookup.unreflectConstructor(Constructor), converting any
encountered IllegalAccessException into an IllegalAccessError.c - the constructor to unreflectpublic java.lang.invoke.MethodHandle findSpecial(Class<?> declaringClass, String name, java.lang.invoke.MethodType type)
IllegalAccessException into an IllegalAccessError and a
NoSuchMethodException into a NoSuchMethodError.declaringClass - class declaring the methodname - the name of the methodtype - the type of the methodIllegalAccessError - if the method is inaccessible.NoSuchMethodError - if the method does not exist.public java.lang.invoke.MethodHandle findStatic(Class<?> declaringClass, String name, java.lang.invoke.MethodType type)
IllegalAccessException into an
IllegalAccessError and a NoSuchMethodException into a NoSuchMethodError.declaringClass - class declaring the methodname - the name of the methodtype - the type of the methodIllegalAccessError - if the method is inaccessible.NoSuchMethodError - if the method does not exist.public java.lang.invoke.MethodHandle findVirtual(Class<?> declaringClass, String name, java.lang.invoke.MethodType type)
IllegalAccessException into an
IllegalAccessError and a NoSuchMethodException into a NoSuchMethodError.declaringClass - class declaring the methodname - the name of the methodtype - the type of the methodIllegalAccessError - if the method is inaccessible.NoSuchMethodError - if the method does not exist.public static java.lang.invoke.MethodHandle findOwnSpecial(java.lang.invoke.MethodHandles.Lookup lookup, String name, Class<?> rtype, Class<?>... ptypes)
findSpecial(Class, String, MethodType) a method on that lookup's class.
Useful in classes' code for convenient linking to their own privates.lookup - the lookup for the classname - the name of the methodrtype - the return type of the methodptypes - the parameter types of the methodpublic java.lang.invoke.MethodHandle findOwnSpecial(String name, Class<?> rtype, Class<?>... ptypes)
findSpecial(Class, String, MethodType) a method on that lookup's class. Useful in classes'
code for convenient linking to their own privates. It's easier to use than findSpecial in that you can
just list the parameter types, and don't have to specify lookup class.name - the name of the methodrtype - the return type of the methodptypes - the parameter types of the methodpublic static java.lang.invoke.MethodHandle findOwnStatic(java.lang.invoke.MethodHandles.Lookup lookup, String name, Class<?> rtype, Class<?>... ptypes)
findStatic(Class, String, MethodType) a method on that lookup's class.
Useful in classes' code for convenient linking to their own privates. It's easier to use than findStatic
in that you can just list the parameter types, and don't have to specify lookup class.lookup - the lookup for the classname - the name of the methodrtype - the return type of the methodptypes - the parameter types of the methodpublic java.lang.invoke.MethodHandle findOwnStatic(String name, Class<?> rtype, Class<?>... ptypes)
findStatic(Class, String, MethodType) a method on that lookup's class. Useful in classes'
code for convenient linking to their own privates. It's easier to use than findStatic in that you can
just list the parameter types, and don't have to specify lookup class.name - the name of the methodrtype - the return type of the methodptypes - the parameter types of the methodCopyright © 2013 Attila Szegedi. All Rights Reserved.