java.lang.Object
jdk.dynalink.linker.support.Lookup
A wrapper around 
MethodHandles.Lookup that masks
 checked exceptions. It is useful in those cases when you're looking up
 methods within your own codebase (therefore it is an error if they are not
 present).- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final LookupA canonical Lookup object that wrapsMethodHandles.publicLookup().
- 
Constructor SummaryConstructorsConstructorDescriptionLookup(MethodHandles.Lookup lookup) Creates a new instance, bound to an instance ofMethodHandles.Lookup.
- 
Method SummaryModifier and TypeMethodDescriptionfindGetter(Class<?> refc, String name, Class<?> type) Performs aMethodHandles.Lookup.findGetter(Class, String, Class), converting any encounteredIllegalAccessExceptioninto anIllegalAccessErrorandNoSuchFieldExceptioninto aNoSuchFieldError.static MethodHandlefindOwnSpecial(MethodHandles.Lookup lookup, String name, Class<?> rtype, Class<?>... ptypes) Given a lookup, finds usingfindSpecial(Class, String, MethodType)a method on that lookup's class.findOwnSpecial(String name, Class<?> rtype, Class<?>... ptypes) Finds usingfindSpecial(Class, String, MethodType)a method on that lookup's class.static MethodHandlefindOwnStatic(MethodHandles.Lookup lookup, String name, Class<?> rtype, Class<?>... ptypes) Given a lookup, finds usingfindStatic(Class, String, MethodType)a method on that lookup's class.findOwnStatic(String name, Class<?> rtype, Class<?>... ptypes) Finds usingfindStatic(Class, String, MethodType)a method on that lookup's class.findSpecial(Class<?> declaringClass, String name, MethodType type) Performs aMethodHandles.Lookup.findSpecial(Class, String, MethodType, Class)on the underlying lookup.findStatic(Class<?> declaringClass, String name, MethodType type) Performs aMethodHandles.Lookup.findStatic(Class, String, MethodType)on the underlying lookup.findVirtual(Class<?> declaringClass, String name, MethodType type) Performs aMethodHandles.Lookup.findVirtual(Class, String, MethodType)on the underlying lookup.static MethodHandleunreflect(MethodHandles.Lookup lookup, Method m) Performs aMethodHandles.Lookup.unreflect(Method), converting any encounteredIllegalAccessExceptioninto anIllegalAccessError.Performs aMethodHandles.Lookup.unreflect(Method), converting any encounteredIllegalAccessExceptioninto anIllegalAccessError.static MethodHandleunreflectConstructor(MethodHandles.Lookup lookup, Constructor<?> c) Performs aMethodHandles.Lookup.unreflectConstructor(Constructor), converting any encounteredIllegalAccessExceptioninto anIllegalAccessError.Performs aMethodHandles.Lookup.unreflectConstructor(Constructor), converting any encounteredIllegalAccessExceptioninto anIllegalAccessError.Performs aMethodHandles.Lookup.unreflectGetter(Field), converting any encounteredIllegalAccessExceptioninto anIllegalAccessError.Performs aMethodHandles.Lookup.unreflectSetter(Field), converting any encounteredIllegalAccessExceptioninto anIllegalAccessError.
- 
Field Details- 
PUBLICA canonical Lookup object that wrapsMethodHandles.publicLookup().
 
- 
- 
Constructor Details- 
LookupCreates a new instance, bound to an instance ofMethodHandles.Lookup.- Parameters:
- lookup- the- MethodHandles.Lookupit delegates to.
 
 
- 
- 
Method Details- 
unreflectPerforms aMethodHandles.Lookup.unreflect(Method), converting any encounteredIllegalAccessExceptioninto anIllegalAccessError.- Parameters:
- m- the method to unreflect
- Returns:
- the unreflected method handle.
- Throws:
- IllegalAccessError- if the method is inaccessible.
 
- 
unreflectPerforms aMethodHandles.Lookup.unreflect(Method), converting any encounteredIllegalAccessExceptioninto anIllegalAccessError.- Parameters:
- lookup- the lookup used to unreflect
- m- the method to unreflect
- Returns:
- the unreflected method handle.
- Throws:
- IllegalAccessError- if the method is inaccessible.
 
- 
unreflectGetterPerforms aMethodHandles.Lookup.unreflectGetter(Field), converting any encounteredIllegalAccessExceptioninto anIllegalAccessError.- Parameters:
- f- the field for which a getter is unreflected
- Returns:
- the unreflected field getter handle.
- Throws:
- IllegalAccessError- if the getter is inaccessible.
 
- 
findGetterPerforms aMethodHandles.Lookup.findGetter(Class, String, Class), converting any encounteredIllegalAccessExceptioninto anIllegalAccessErrorandNoSuchFieldExceptioninto aNoSuchFieldError.- Parameters:
- refc- the class declaring the field
- name- the name of the field
- type- the type of the field
- Returns:
- the unreflected field getter handle.
- Throws:
- IllegalAccessError- if the field is inaccessible.
- NoSuchFieldError- if the field does not exist.
 
- 
unreflectSetterPerforms aMethodHandles.Lookup.unreflectSetter(Field), converting any encounteredIllegalAccessExceptioninto anIllegalAccessError.- Parameters:
- f- the field for which a setter is unreflected
- Returns:
- the unreflected field setter handle.
- Throws:
- IllegalAccessError- if the field is inaccessible.
- NoSuchFieldError- if the field does not exist.
 
- 
unreflectConstructorPerforms aMethodHandles.Lookup.unreflectConstructor(Constructor), converting any encounteredIllegalAccessExceptioninto anIllegalAccessError.- Parameters:
- c- the constructor to unreflect
- Returns:
- the unreflected constructor handle.
- Throws:
- IllegalAccessError- if the constructor is inaccessible.
 
- 
unreflectConstructorPerforms aMethodHandles.Lookup.unreflectConstructor(Constructor), converting any encounteredIllegalAccessExceptioninto anIllegalAccessError.- Parameters:
- lookup- the lookup used to unreflect
- c- the constructor to unreflect
- Returns:
- the unreflected constructor handle.
- Throws:
- IllegalAccessError- if the constructor is inaccessible.
 
- 
findSpecialPerforms aMethodHandles.Lookup.findSpecial(Class, String, MethodType, Class)on the underlying lookup. Converts any encounteredIllegalAccessExceptioninto anIllegalAccessErrorandNoSuchMethodExceptioninto aNoSuchMethodError.- Parameters:
- declaringClass- class declaring the method
- name- the name of the method
- type- the type of the method
- Returns:
- a method handle for the method
- Throws:
- IllegalAccessError- if the method is inaccessible.
- NoSuchMethodError- if the method does not exist.
 
- 
findStaticPerforms aMethodHandles.Lookup.findStatic(Class, String, MethodType)on the underlying lookup. Converts any encounteredIllegalAccessExceptioninto anIllegalAccessErrorandNoSuchMethodExceptioninto aNoSuchMethodError.- Parameters:
- declaringClass- class declaring the method
- name- the name of the method
- type- the type of the method
- Returns:
- a method handle for the method
- Throws:
- IllegalAccessError- if the method is inaccessible.
- NoSuchMethodError- if the method does not exist.
 
- 
findVirtualPerforms aMethodHandles.Lookup.findVirtual(Class, String, MethodType)on the underlying lookup. Converts any encounteredIllegalAccessExceptioninto anIllegalAccessErrorandNoSuchMethodExceptioninto aNoSuchMethodError.- Parameters:
- declaringClass- class declaring the method
- name- the name of the method
- type- the type of the method
- Returns:
- a method handle for the method
- Throws:
- IllegalAccessError- if the method is inaccessible.
- NoSuchMethodError- if the method does not exist.
 
- 
findOwnSpecialpublic static MethodHandle findOwnSpecial(MethodHandles.Lookup lookup, String name, Class<?> rtype, Class<?>... ptypes) Given a lookup, finds usingfindSpecial(Class, String, MethodType)a method on that lookup's class. Useful in classes' code for convenient linking to their own privates.- Parameters:
- lookup- the lookup for the class
- name- the name of the method
- rtype- the return type of the method
- ptypes- the parameter types of the method
- Returns:
- the method handle for the method
 
- 
findOwnSpecialFinds usingfindSpecial(Class, String, MethodType)a method on that lookup's class. Useful in classes' code for convenient linking to their own privates. It's also more convenient thanfindSpecialin that you can just list the parameter types, and don't have to specify lookup class.- Parameters:
- name- the name of the method
- rtype- the return type of the method
- ptypes- the parameter types of the method
- Returns:
- the method handle for the method
 
- 
findOwnStaticpublic static MethodHandle findOwnStatic(MethodHandles.Lookup lookup, String name, Class<?> rtype, Class<?>... ptypes) Given a lookup, finds usingfindStatic(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 thanfindStaticin that you can just list the parameter types, and don't have to specify lookup class.- Parameters:
- lookup- the lookup for the class
- name- the name of the method
- rtype- the return type of the method
- ptypes- the parameter types of the method
- Returns:
- the method handle for the method
 
- 
findOwnStaticFinds usingfindStatic(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 thanfindStaticin that you can just list the parameter types, and don't have to specify lookup class.- Parameters:
- name- the name of the method
- rtype- the return type of the method
- ptypes- the parameter types of the method
- Returns:
- the method handle for the method
 
 
-