public class Guards extends Object
| Modifier and Type | Method and Description |
|---|---|
static java.lang.invoke.MethodHandle |
asType(LinkerServices linkerServices,
java.lang.invoke.MethodHandle test,
java.lang.invoke.MethodType type)
Takes a guard-test method handle, and adapts it to the requested type, returning a boolean.
|
static java.lang.invoke.MethodHandle |
asType(java.lang.invoke.MethodHandle test,
java.lang.invoke.MethodType type)
Takes a guard-test method handle, and adapts it to the requested type, returning a boolean.
|
static boolean |
canReferenceDirectly(ClassLoader referrerLoader,
ClassLoader referredLoader)
Return true if it is safe to strongly reference a class from the referred class loader from a class associated
with the referring class loader without risking a class loader memory leak.
|
static java.lang.invoke.MethodHandle |
getClassGuard(Class<?> clazz)
Creates a guard method that tests its only argument for being of an exact particular class.
|
static java.lang.invoke.MethodHandle |
getIdentityGuard(Object obj)
Creates a guard method that tests its only argument for being referentially identical to another object
|
static java.lang.invoke.MethodHandle |
getInstanceOfGuard(Class<?> clazz)
Creates a guard method that tests its only argument for being an instance of a particular class.
|
static java.lang.invoke.MethodHandle |
isArray(int pos,
java.lang.invoke.MethodType type)
Creates a method handle that returns true if the argument in the specified position is a Java array.
|
static java.lang.invoke.MethodHandle |
isInstance(Class<?> clazz,
int pos,
java.lang.invoke.MethodType type)
Creates a method handle with arguments of a specified type, but with boolean return value.
|
static java.lang.invoke.MethodHandle |
isInstance(Class<?> clazz,
java.lang.invoke.MethodType type)
Creates a method handle with arguments of a specified type, but with boolean return value.
|
static java.lang.invoke.MethodHandle |
isNotNull()
Returns a guard that tests whether the first argument is not null.
|
static java.lang.invoke.MethodHandle |
isNull()
Returns a guard that tests whether the first argument is null.
|
static java.lang.invoke.MethodHandle |
isOfClass(Class<?> clazz,
java.lang.invoke.MethodType type)
Creates a guard method handle with arguments of a specified type, but with boolean return value.
|
public static java.lang.invoke.MethodHandle isOfClass(Class<?> clazz, java.lang.invoke.MethodType type)
clazz - the class of the first argument to test fortype - the method typepublic static java.lang.invoke.MethodHandle isInstance(Class<?> clazz, java.lang.invoke.MethodType type)
clazz - the class of the first argument to test fortype - the method typepublic static java.lang.invoke.MethodHandle isInstance(Class<?> clazz, int pos, java.lang.invoke.MethodType type)
clazz - the class of the first argument to test forpos - the position on the argument list to testtype - the method typepublic static java.lang.invoke.MethodHandle isArray(int pos, java.lang.invoke.MethodType type)
pos - the position in the argument littype - the method type of the handlepublic static boolean canReferenceDirectly(ClassLoader referrerLoader, ClassLoader referredLoader)
referrerLoader - the referrer class loaderreferredLoader - the referred class loaderpublic static java.lang.invoke.MethodHandle asType(java.lang.invoke.MethodHandle test, java.lang.invoke.MethodType type)
MethodHandle.asType(MethodType).test - the test method handletype - the type to adapt the method handle topublic static java.lang.invoke.MethodHandle asType(LinkerServices linkerServices, java.lang.invoke.MethodHandle test, java.lang.invoke.MethodType type)
LinkerServices object's LinkerServices.asType(MethodHandle, MethodType).linkerServices - the linker services to use for type conversionstest - the test method handletype - the type to adapt the method handle topublic static java.lang.invoke.MethodHandle getClassGuard(Class<?> clazz)
clazz - the class to test for.public static java.lang.invoke.MethodHandle getInstanceOfGuard(Class<?> clazz)
clazz - the class to test for.public static java.lang.invoke.MethodHandle getIdentityGuard(Object obj)
obj - the object used as referential identity testpublic static java.lang.invoke.MethodHandle isNull()
public static java.lang.invoke.MethodHandle isNotNull()
Copyright © 2013 Attila Szegedi. All Rights Reserved.