com.vaadin.util
Class CurrentInstance

java.lang.Object
  extended by com.vaadin.util.CurrentInstance

public class CurrentInstance
extends java.lang.Object

Keeps track of various thread local instances used by the framework.

Since:
7.0.0
Version:
@VERSION@
Author:
Vaadin Ltd

Method Summary
static void clearAll()
          Clears all current instances.
static
<T> T
get(java.lang.Class<T> type)
          Gets the current instance of a specific type if available.
static
<T> void
set(java.lang.Class<T> type, T instance)
          Sets the current instance of the given type.
static
<T> void
setInheritable(java.lang.Class<T> type, T instance)
          Sets the current inheritable instance of the given type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

get

public static <T> T get(java.lang.Class<T> type)
Gets the current instance of a specific type if available.

Parameters:
type - the class to get an instance of
Returns:
the current instance or the provided type, or null if there is no current instance.

set

public static <T> void set(java.lang.Class<T> type,
                           T instance)
Sets the current instance of the given type.

Parameters:
type - the class that should be used when getting the current instance back
instance - the actual instance
See Also:
setInheritable(Class, Object), ThreadLocal

setInheritable

public static <T> void setInheritable(java.lang.Class<T> type,
                                      T instance)
Sets the current inheritable instance of the given type. A current instance that is inheritable will be available for child threads.

Parameters:
type - the class that should be used when getting the current instance back
instance - the actual instance
See Also:
set(Class, Object), InheritableThreadLocal

clearAll

public static void clearAll()
Clears all current instances.



Copyright © 2000-2011 Vaadin Ltd. All Rights Reserved.