com.force.sdk.connector.threadlocal
Class ForceThreadLocalStore

java.lang.Object
  extended by com.force.sdk.connector.threadlocal.ForceThreadLocalStore

public final class ForceThreadLocalStore
extends Object

Class for storing connector configs in a ThreadLocal cache.

Author:
John Simone

Method Summary
static ForceConnectorConfig getConnectorConfig()
          Retrieves the ForceConnectorConfig from the ForceThreadLocalStore ThreadLocal cache.
static
<T> T
getThreadLocal(Class<T> clazz)
          Retrieve the object of type clazz from the ForceThreadLocalStore ThreadLocal cache.
static void setConnectorConfig(ForceConnectorConfig config)
          Sets the given ForceConnectorConfig in the ForceThreadLocalStore ThreadLocal cache.
static
<T> void
setThreadLocal(Class<T> clazz, T variable)
          Sets an object of type clazz in the ForceThreadLocalStore ThreadLocal cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getConnectorConfig

public static ForceConnectorConfig getConnectorConfig()
Retrieves the ForceConnectorConfig from the ForceThreadLocalStore ThreadLocal cache.

Returns:
the ForceConnectorConfig found in the ThreadLocal cache; null if the cache is empty

setConnectorConfig

public static void setConnectorConfig(ForceConnectorConfig config)
Sets the given ForceConnectorConfig in the ForceThreadLocalStore ThreadLocal cache.

Parameters:
config - the ForceConnectorConfig to be added to the ThreadLocal cache

getThreadLocal

public static <T> T getThreadLocal(Class<T> clazz)
Retrieve the object of type clazz from the ForceThreadLocalStore ThreadLocal cache.

Type Parameters:
T - describes the object type to be searched for in the ThreadLocal cache
Parameters:
clazz - the object type to be searched for in the ThreadLocal cache
Returns:
the object of type clazz found in the ThreadLocal cache; null if no such object can be found

setThreadLocal

public static <T> void setThreadLocal(Class<T> clazz,
                                      T variable)
Sets an object of type clazz in the ForceThreadLocalStore ThreadLocal cache.

Type Parameters:
T - describes the object type to be added to the ThreadLocal cache
Parameters:
clazz - the object type to be added to the ThreadLocal cache
variable - the object to be added to the ThreadLocal cache


Copyright © 2011. All Rights Reserved.