Class GroovyCategorySupport.ThreadCategoryInfo

java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<String,GroovyCategorySupport.CategoryMethodList>
org.codehaus.groovy.runtime.GroovyCategorySupport.ThreadCategoryInfo
All Implemented Interfaces:
Serializable, Cloneable, Map<String,GroovyCategorySupport.CategoryMethodList>
Enclosing class:
GroovyCategorySupport

public static class GroovyCategorySupport.ThreadCategoryInfo extends HashMap<String,GroovyCategorySupport.CategoryMethodList>
Category methods active on one thread, keyed by method name. Each use pushes a scope and pops it when the closure finishes. Getters and setters are also indexed by property name.
See Also:
  • Constructor Details

    • ThreadCategoryInfo

      public ThreadCategoryInfo()
  • Method Details

    • use

      public <T> T use(List<Class> categoryClasses, Closure<T> closure)
      Opens a scope, installs the public static methods of each class in categoryClasses, and calls closure. The scope is closed on the way out, including when the closure throws. A method is installed only when it is public and static and has at least one parameter; the first parameter type is the receiver. Methods inherited from superclasses are installed too, stopping before Object.
      Type Parameters:
      T - return type of closure
      Parameters:
      categoryClasses - classes that supply category methods, applied in order
      closure - called while those methods are visible
      Returns:
      the value returned by closure
    • getCategoryMethods

      public GroovyCategorySupport.CategoryMethodList getCategoryMethods(String name)
      Returns the category methods registered under name while a scope is active.
      Parameters:
      name - method name to look up
      Returns:
      the list for name, or null when this thread is not inside use or no method of that name is registered