public class GroovyCategorySupport
extends Object
Support methods for Groovy category usage
| Modifiers | Name | Description |
|---|---|---|
static class |
GroovyCategorySupport.CategoryMethod |
A public static category method seen as an instance method of its first parameter type. |
static class |
GroovyCategorySupport.CategoryMethodList |
Category methods that share one name at a single use
nesting level. |
static class |
GroovyCategorySupport.ThreadCategoryInfo |
Category methods active on one thread, keyed by method name. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public static GroovyCategorySupport.CategoryMethodList |
getCategoryMethods(String name)This method is used to pull all the new methods out of the local thread context with a particular name. |
|
public static AtomicInteger |
getCategoryNameUsage(String name)Returns the shared counter of category methods named name
that are currently installed. |
|
public static String |
getPropertyCategoryGetterName(String propertyName)Returns the category getter installed for propertyName on
the current thread. |
|
public static String |
getPropertyCategorySetterName(String propertyName)Returns the category setter installed for propertyName on
the current thread. |
|
public static boolean |
hasCategoryInAnyThread()Reports whether a use scope is open on any thread. |
|
public static boolean |
hasCategoryInCurrentThread()Reports whether the current thread is inside a use block.
|
<T> |
public static T |
use(Class categoryClass, Closure<T> closure)Create a scope based on given categoryClass and invoke closure within that scope. |
<T> |
public static T |
use(List<Class> categoryClasses, Closure<T> closure)Create a scope based on given categoryClasses and invoke closure within that scope. |
This method is used to pull all the new methods out of the local thread context with a particular name.
name - the method name of interest Returns the shared counter of category methods named name
that are currently installed. The same counter is incremented as
methods are added and adjusted as a scope ends.
name - category method namename, created at zero on first use Returns the category getter installed for propertyName on
the current thread. Both getX and boolean isX
methods are eligible. When propertyName is not a key, its
decapitalized spelling is tried.
propertyName - property whose getter is required Returns the category setter installed for propertyName on
the current thread. When propertyName is not a key, its
decapitalized spelling is tried.
propertyName - property whose setter is required Reports whether a use scope is open on any thread.
true when at least one category scope is still active Reports whether the current thread is inside a use block.
Returns false at once when no thread has an active category scope.
true when this thread's category scope depth is non-zeroCreate a scope based on given categoryClass and invoke closure within that scope.
T - return type of closurecategoryClass - the class containing category methodsclosure - the closure during which to make the category class methods availableCreate a scope based on given categoryClasses and invoke closure within that scope.
T - return type of closurecategoryClasses - the list of classes containing category methodsclosure - the closure during which to make the category class methods available