Overview | Package | Class
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.groovy.runtime.metaclass
Class ThreadManagedMetaBeanProperty

This MetaBeanProperty will create a pseudo property whose value is bound to the current Thread using soft references. The values will go out of scope and be garabage collected when the Thread dies or when memory is required by the JVM

The property uses an InheritableThreadLocal instance internally so child threads will still be able to see the property

author:
  Graeme Rocher

since:
  1.1

Field Summary
`ThreadLocal` | `PROPERTY_INSTANCE_HOLDER`
`String` | `PROPERTY_SET_PREFIX`
`def` | `ZERO_ARGUMENT_LIST`
`Class` | `declaringClass`
`ThreadBoundGetter` | `getter`
`Object` | `initialValue`
`Closure` | `initialValueCreator`
`ThreadBoundSetter` | `setter`

Constructor Summary
`ThreadManagedMetaBeanProperty(Class declaringClass, String name, Class type, Object iv)` Constructs a new ThreadManagedBeanProperty for the given arguments
`ThreadManagedMetaBeanProperty(Class declaringClass, String name, Class type, Closure initialValueCreator)` Constructs a new ThreadManagedBeanProperty for the given arguments

Method Summary
`MetaMethod` | `getGetter()`
`Object` | `getInitialValue()` Retrieves the initial value of the ThreadBound property
`Object` | `getInitialValue(Object object)`
`MetaMethod` | `getSetter()`
`static Map` | `getThreadBoundPropertMap()`
`static Object` | `getThreadBoundPropertyValue(Object obj, String name, Object initialValue)`
`void` | `setInitialValueCreator(Closure callable)` Closure responsible for creating the initial value of thread-managed bean properties
`static Object` | `setThreadBoundPropertyValue(Object obj, String name, Object value)`

Constructor Detail

### ThreadManagedMetaBeanProperty

    public ThreadManagedMetaBeanProperty(Class declaringClass, String name, Class type, Object iv)

  Constructs a new ThreadManagedBeanProperty for the given arguments
  param:
    declaringClass The class that declares the property
  param:
    name The name of the property
  param:
    type The type of the property
  param:
    iv The properties initial value

### ThreadManagedMetaBeanProperty

    public ThreadManagedMetaBeanProperty(Class declaringClass, String name, Class type, Closure initialValueCreator)

  Constructs a new ThreadManagedBeanProperty for the given arguments
  param:
    declaringClass The class that declares the property
  param:
    name The name of the property
  param:
    type The type of the property
  param:
    initialValueCreator The closure responsible for creating the initial value

Method Detail

### getGetter

    public MetaMethod getGetter()

### getInitialValue

    public Object getInitialValue()

  Retrieves the initial value of the ThreadBound property
  return:
    The initial value

### getInitialValue

    public Object getInitialValue(Object object)

### getSetter

    public MetaMethod getSetter()

### getThreadBoundPropertMap

    static Map getThreadBoundPropertMap()

### getThreadBoundPropertyValue

    static Object getThreadBoundPropertyValue(Object obj, String name, Object initialValue)

### setInitialValueCreator

    public void setInitialValueCreator(Closure callable)

  Closure responsible for creating the initial value of thread-managed bean properties
  param:
    callable The closure responsible for creating the initial value

### setThreadBoundPropertyValue

    static Object setThreadBoundPropertyValue(Object obj, String name, Object value)