|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.jlf.util.ClassInstanceVariable
This class provides the concept of a Class Instance Variable as implemented in the Smalltalk language, with an additional optional context setting as well. Use this class to implement caches and other concepts where you would traditionally need a class/static variable that is inherited but different for every subclass.
Field Summary | |
protected static ClassInstanceVariable |
singleton
|
protected java.util.Hashtable |
variableList
|
Constructor Summary | |
protected |
ClassInstanceVariable()
|
Method Summary | |
protected static ClassInstanceVariable |
getInstance()
|
static java.lang.Object |
getVariable(java.lang.Class variableClass,
java.lang.String variableName)
Gets a variable for a particular class. |
static java.lang.Object |
getVariableInContext(java.lang.Class variableClass,
java.lang.String variableName,
java.lang.Object context)
Gets a variable for a particular class. |
protected java.lang.Object |
getVariableInContextI(java.lang.Class variableClass,
java.lang.String variableName,
java.lang.Object context)
|
static void |
setVariable(java.lang.Class variableClass,
java.lang.String variableName,
java.lang.Object value)
Sets a variable for a particular class. |
static void |
setVariableInContext(java.lang.Class variableClass,
java.lang.String variableName,
java.lang.Object context,
java.lang.Object value)
Sets a variable for a particular class. |
protected void |
setVariableInContextI(java.lang.Class variableClass,
java.lang.String variableName,
java.lang.Object context,
java.lang.Object value)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static ClassInstanceVariable singleton
protected java.util.Hashtable variableList
Constructor Detail |
protected ClassInstanceVariable()
Method Detail |
protected static ClassInstanceVariable getInstance()
public static void setVariable(java.lang.Class variableClass, java.lang.String variableName, java.lang.Object value)
variableClass
- The Class the variable will be associated with.variableName
- The name of the variable for that class.value
- The value that variable should be set to.public static void setVariableInContext(java.lang.Class variableClass, java.lang.String variableName, java.lang.Object context, java.lang.Object value)
variableClass
- The Class the variable will be associated with.variableName
- The name of the variable for that class.context
- An object that further controls the uniqueness
of the variable. For example, the variable may have different
settings for different users, so this object may be a User object.
This object must properly implement the equals() protocol.value
- The value that variable should be set to.public static java.lang.Object getVariable(java.lang.Class variableClass, java.lang.String variableName)
variableClass
- The Class the variable will be associated with.variableName
- The name of the variable for that class.
public static java.lang.Object getVariableInContext(java.lang.Class variableClass, java.lang.String variableName, java.lang.Object context)
variableClass
- The Class the variable will be associated with.variableName
- The name of the variable for that class.context
- An object that further controls the uniqueness
of the variable. For example, the variable may have different
settings for different users, so this object may be a User object.
This object must properly implement the equals() protocol.
protected void setVariableInContextI(java.lang.Class variableClass, java.lang.String variableName, java.lang.Object context, java.lang.Object value)
protected java.lang.Object getVariableInContextI(java.lang.Class variableClass, java.lang.String variableName, java.lang.Object context)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |