|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.morph.context.contexts.BaseContext
public abstract class BaseContext
Convenient base class for Contexts. Validates arguments and takes care of
logging and exception handling. Also implements the Map
interface.
As a Map, this class only supports non-null Strings for keys (i.e. - calling
Map.put(new Object(), new Object()) will throw a
ContextException).
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
java.util.Map.Entry<K,V> |
| Constructor Summary | |
|---|---|
BaseContext()
Create a new BaseContext. |
|
| Method Summary | |
|---|---|
void |
clear()
|
boolean |
containsKey(java.lang.Object key)
The implementation of this method has O(n) time complexity. |
boolean |
containsValue(java.lang.Object value)
|
java.util.Set |
entrySet()
|
java.lang.Object |
get(java.lang.Object key)
|
java.lang.Object |
get(java.lang.String expression)
Retrieve the property named propertyName. |
java.lang.Object |
get(java.lang.String expression,
java.lang.Class destinationClass)
Retrieve the information indicated by expression as the
type indicated by destinationClass. |
java.lang.Object |
get(java.lang.String expression,
java.lang.Class destinationClass,
java.util.Locale locale)
Retrieve the information indicated by expression as the
type indicated by destinationClass. |
java.lang.Object |
get(java.lang.String expression,
java.util.Locale locale,
java.lang.Class destinationClass)
Retrieve the information indicated by expression as the
type indicated by destinationClass. |
ContextMapBridge |
getContextMapBridge()
Get the ContextMapBridge. |
Converter |
getConverter()
Get the converter. |
protected abstract java.lang.Object |
getImpl(java.lang.String propertyName)
Implement get(propertyName). |
Language |
getLanguage()
Get the Language. |
protected org.apache.commons.logging.Log |
getLog()
Get the log. |
java.lang.String[] |
getPropertyNames()
Gets the names of the properties which are currently defined for this context. |
protected abstract java.lang.String[] |
getPropertyNamesImpl()
Implement getPropertyNames() |
boolean |
isEmpty()
|
java.util.Set |
keySet()
|
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
|
void |
putAll(java.util.Map t)
|
java.lang.Object |
remove(java.lang.Object key)
|
void |
set(java.lang.String expression,
java.lang.Object value)
Sets propertyName to propertyValue. |
void |
set(java.lang.String expression,
java.lang.Object value,
java.util.Locale locale)
Sets the information indicated by expression on
target. |
void |
setContextMapBridge(ContextMapBridge contextMapBridge)
Set the ContextMapBridge. |
void |
setConverter(Converter converter)
Set the converter. |
protected abstract void |
setImpl(java.lang.String propertyName,
java.lang.Object propertyValue)
Implement set(propertyName, propertyValue). |
void |
setLanguage(Language language)
Set the Language. |
protected void |
setLog(org.apache.commons.logging.Log log)
Set the Log. |
int |
size()
|
java.util.Collection |
values()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public BaseContext()
| Method Detail |
|---|
protected abstract java.lang.String[] getPropertyNamesImpl()
throws java.lang.Exception
java.lang.Exception - if errors occur
protected abstract java.lang.Object getImpl(java.lang.String propertyName)
throws java.lang.Exception
get(propertyName).
propertyName - to get
java.lang.Exception - in case of errors
protected abstract void setImpl(java.lang.String propertyName,
java.lang.Object propertyValue)
throws java.lang.Exception
set(propertyName, propertyValue).
propertyName - to setpropertyValue - to set
java.lang.Exception - in case of errors
public final java.lang.String[] getPropertyNames()
throws ContextException
Context#PROPERTY_NAMES_PROPERTY as
one of the properties in the returned array.
getPropertyNames in interface ContextContextException - if the properties could not be retieved for some reason
public final java.lang.Object get(java.lang.String expression)
throws ContextException
propertyName. The property
Context#PROPERTY_NAMES_PROPERTY has special symantics. Unless a
value for this property has already been explicitly specified for the
context, context.get(PROPERTY_NAMES_PROPERTY) will return
the same result as Context.getPropertyNames().
get in interface Contextget in interface DecoratedContextexpression - the name of the property to be retrieved, if the property has
been defined or null, if the property is not defined
ContextException - if propertyName is empty or
public final void set(java.lang.String expression,
java.lang.Object value)
throws ContextException
propertyName to propertyValue.
set in interface Contextset in interface DecoratedContextexpression - the name of the property to setvalue - the new value for the property
ContextException - if propertyName is empty or
public final java.lang.Object get(java.lang.String expression,
java.lang.Class destinationClass)
throws ContextException
expression as the
type indicated by destinationClass.
get in interface DecoratedContextexpression - an expression specifying which information to retrievedestinationClass - indicates the type that should be returned by this method
ContextException - if the expression is invalid or an error occurrs while
attempting to retrieve the requested information
public final java.lang.Object get(java.lang.String expression,
java.lang.Class destinationClass,
java.util.Locale locale)
throws ContextException
expression as the
type indicated by destinationClass.
get in interface DecoratedContextexpression - an expression specifying which information to retrievedestinationClass - indicates the type that should be returned by this methodlocale - indicates the locale in which the conversion to type
destinationClass should be performed, if
applicable
ContextException - if the expression is invalid or an error occurrs while
attempting to retrieve the requested information
public final java.lang.Object get(java.lang.String expression,
java.util.Locale locale,
java.lang.Class destinationClass)
throws ContextException
expression as the
type indicated by destinationClass.
get in interface DecoratedContextexpression - an expression specifying which information to retrievelocale - indicates the locale in which the conversion to type
destinationClass should be performed, if
applicabledestinationClass - indicates the type that should be returned by this method
ContextException - if the expression is invalid or an error occurred while
attempting to retrieve the requested information
public final void set(java.lang.String expression,
java.lang.Object value,
java.util.Locale locale)
throws ContextException
expression on
target. value will be automatically
converted to a type appropriate for the given expression.
set in interface DecoratedContextexpression - an expression specifying which information will be modifiedvalue - the information to be changedlocale - indicates the locale in which the conversion to type
destinationClass should be performed, if
applicable
ContextException - if the given expression is invalid or an error occurred while
attempting to set the given valuepublic void clear()
clear in interface java.util.Mappublic boolean containsKey(java.lang.Object key)
containsKey in interface java.util.MapMap.containsKey(java.lang.Object)public boolean containsValue(java.lang.Object value)
containsValue in interface java.util.Mappublic java.util.Set entrySet()
entrySet in interface java.util.Mappublic java.lang.Object get(java.lang.Object key)
get in interface java.util.Mappublic boolean isEmpty()
isEmpty in interface java.util.Mappublic java.util.Set keySet()
keySet in interface java.util.Map
public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
put in interface java.util.Mappublic void putAll(java.util.Map t)
putAll in interface java.util.Mappublic java.lang.Object remove(java.lang.Object key)
remove in interface java.util.Mappublic int size()
size in interface java.util.Mappublic java.util.Collection values()
values in interface java.util.Mappublic Converter getConverter()
public void setConverter(Converter converter)
converter - The converter to set.public Language getLanguage()
public void setLanguage(Language language)
language - The language to set.public void setContextMapBridge(ContextMapBridge contextMapBridge)
contextMapBridge - to setpublic ContextMapBridge getContextMapBridge()
protected org.apache.commons.logging.Log getLog()
protected void setLog(org.apache.commons.logging.Log log)
log - to set
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||