public class CachedSAMClass
extends CachedClass
Provides optimized reflection caching for Single Abstract Method (SAM) types. Converts Closure arguments to SAM interface implementations via dynamic proxies or aggregates.
| Fields inherited from class | Fields |
|---|---|
class CachedClass |
EMPTY_ARRAY, classInfo, isArray, isInterface, isNumber, isPrimitive, modifiers, mopMethods |
| Constructor and description |
|---|
CachedSAMClass(Class clazz, ClassInfo classInfo)Constructs a cached class representation for a SAM type. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public Object |
coerceArgument(Object argument)Coerces the given argument to this SAM type. |
|
public static Object |
coerceToSAM(Closure argument, Method method, Class clazz)Coerces a closure to a SAM interface implementation. |
|
public static Object |
coerceToSAM(Closure argument, Method method, Class clazz, boolean isInterface)Coerces a closure to a SAM interface or class implementation. |
|
public static Method |
getSAMMethod(Class<?> c)Finds the abstract method of given class, if it is a SAM type. |
|
public boolean |
isAssignableFrom(Class argument)Determines if the given class is assignable to this SAM type. |
| Methods inherited from class | Name |
|---|---|
class CachedClass |
addNewMopMethods, coerceArgument, getCachedClass, getCachedSuperClass, getCallSiteLoader, getConstructors, getDeclaredInterfaces, getFields, getHierarchy, getInterfaces, getMethods, getModifiers, getName, getNewMetaMethods, getSuperClassDistance, getTheClass, getTypeDescription, hashCode, isAssignableFrom, isDirectlyAssignable, isInterface, isPrimitive, isVoid, searchMethods, setNewMopMethods, toString |
Constructs a cached class representation for a SAM type. Locates and caches the single abstract method of the class.
clazz - the SAM type to cacheclassInfo - the class information associated with this cached classCoerces the given argument to this SAM type. Converts Closure arguments to SAM interface implementations via dynamic proxies.
argument - the argument to coerceCoerces a closure to a SAM interface implementation. Automatically detects whether the SAM type is an interface or class.
argument - the closure to convertmethod - the single abstract method of the SAM typeclazz - the SAM class or interface to coerce toCoerces a closure to a SAM interface or class implementation. For interfaces, uses dynamic proxies or trait-aware aggregates. For classes, uses proxy generators to instantiate from base class.
argument - the closure to convertmethod - the single abstract method of the SAM typeclazz - the SAM class or interface to coerce toisInterface - true if the SAM type is an interface, false for a classFinds the abstract method of given class, if it is a SAM type.
Determines if the given class is assignable to this SAM type.
Accepts null, Closure instances, and instances already assignable to the SAM type.
argument - the class to checktrue if the class can be assigned to this SAM type, false otherwiseCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.