org.eclipse.persistence.sdo.helper
Class HelperContextMapKey

java.lang.Object
  extended by org.eclipse.persistence.sdo.helper.HelperContextMapKey

public class HelperContextMapKey
extends Object

Class to facilitate caching of global helper contexts. Instances of this class are intended to be used as the key in the global helper context map in the SDOHelperContext class. Equality will be based on the applicationName attribute if set, or the class loader if applicationName is null. When caching on application name, the loader attribute will be used to determine if a redeployment has occurred; this is necessary, as in the case of a redeploy the applicationName would match, but the loader would be different. Note that all instances of this class are expected to have a loader set.


Constructor Summary
HelperContextMapKey(ClassLoader classLoader)
          This constructor should be used when caching on class loader.
HelperContextMapKey(String applicationName, ClassLoader classLoader)
          This constructor should be used when caching on application name.
 
Method Summary
 boolean equals(Object obj)
          Equality will be based on the applicationName attribute if set, or the class loader if applicationName is null.
 String getApplicationName()
          Return the applicationName value.
 ClassLoader getLoader()
          Return the loader value.
 int hashCode()
          Return a unique hashCode (as an int) for this instance.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HelperContextMapKey

public HelperContextMapKey(ClassLoader classLoader)
This constructor should be used when caching on class loader.

Parameters:
loader -

HelperContextMapKey

public HelperContextMapKey(String applicationName,
                           ClassLoader classLoader)
This constructor should be used when caching on application name. The loader will be used to determine if a redeploy has occurred, i.e. same application name but different class loaders.

Parameters:
applicationName -
loader -
Method Detail

getApplicationName

public String getApplicationName()
Return the applicationName value.

Returns:

getLoader

public ClassLoader getLoader()
Return the loader value.

Returns:

hashCode

public int hashCode()
Return a unique hashCode (as an int) for this instance. The code will be based on the application name if set, otherwise it will be based on the loader. Assumes that this instance's loader is non-null.

Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Equality will be based on the applicationName attribute if set, or the class loader if applicationName is null.

Overrides:
equals in class Object
Parameters:
Object - to be compared to this HelperContextMapKey instance
Returns:
true if the given object is equal to this HelperContextMapKey instance; false otherwise