org.codehaus.groovy.runtime
Class CategoryMethod

Field Summary
 ThreadLocal LOCAL
           
 Class metaClass
           
 
Constructor Summary
CategoryMethod(CachedMethod metaMethod, Class metaClass)
           
 
Method Summary
int compareTo(Object o)
           Sort by most specific to least specific.
static Map copyMapOfList(Map m)
          
static void endScope()
          
static Map getMetaMethods(Map properties, Class metaClass)
          
static List getMethodList(Map metaMethodsMap, String name)
          
static Map getProperties()
          
static boolean hasCategoryInAnyThread()
          
boolean isCacheable()
          
boolean isChildOfParent(Class candidateChild, Class candidateParent)
          
static void newScope()
          
static Object use(Class categoryClass, Closure closure)
           Create a scope based on given categoryClass and invoke closure within that scope.
static Object use(List categoryClasses, Closure closure)
           Create a scope based on given categoryClasses and invoke closure within that scope.
static void use(Class categoryClass)
           Delegated to from the global use(CategoryClass) method.
 

Constructor Detail

CategoryMethod

public CategoryMethod(CachedMethod metaMethod, Class metaClass)


Method Detail

compareTo

public int compareTo(Object o)
Sort by most specific to least specific.
param:
o the object to compare against


copyMapOfList

static Map copyMapOfList(Map m)


endScope

static void endScope()


getMetaMethods

static Map getMetaMethods(Map properties, Class metaClass)


getMethodList

static List getMethodList(Map metaMethodsMap, String name)


getProperties

static Map getProperties()


hasCategoryInAnyThread

public static boolean hasCategoryInAnyThread()


isCacheable

public boolean isCacheable()


isChildOfParent

boolean isChildOfParent(Class candidateChild, Class candidateParent)


newScope

static void newScope()


use

public static Object use(Class categoryClass, Closure closure)
Create a scope based on given categoryClass and invoke closure within that scope.
param:
categoryClass the class containing category methods
param:
closure the closure during which to make the category class methods available
return:
the value returned from the closure


use

public static Object use(List categoryClasses, Closure closure)
Create a scope based on given categoryClasses and invoke closure within that scope.
param:
categoryClasses the list of classes containing category methods
param:
closure the closure during which to make the category class methods available
return:
the value returned from the closure


use

static void use(Class categoryClass)
Delegated to from the global use(CategoryClass) method. It scans the Category class for static methods that take 1 or more parameters. The first parameter is the class you are adding the category method to, additional parameters are those parameters needed by that method. A use statement cannot be undone and is valid only for the current thread.
param:
categoryClass the class containing category methods