| com.metaboss.javatemplate.JavaTemplateContext
All known Subclasses: com.metaboss.javatemplate.JavaTemplateContextMapImpl,
JavaTemplateContext | public interface JavaTemplateContext (Code) | | This interface represents context passed to the template processor method
It is a store of dynamic values to be merged with template. Value stored in context can be of any type.
The context is able to work with context paths specified in two different ways.
- Java naming url The distinguishing feature of this form of context path is that
it has ":/" token somewhere inside (e.g. http:/www.metaboss.com). If Java naming url
is passed to the context - it will delegate actual lookup to the Java Naming And Directory
Interface (JNDI)
- Internal map path The distinguishing feature of this form of context path is that
it does not have ":/" token somewhere inside. This format represents dot separated path
to the value stored in the Map hierarchy (e.g. "Buffer.Size"). The Map hierarchy could be thought of as recursive map
of maps. If the path has one or more dots inside - all parts of the name
except the last one are considered to be the names of the submap. For example the name
'Color' refers to the value containing some sort of color related information
and stored at the top level in the context with the key = 'Color'. The name 'Buffer.Size' refers to the value
stored with the key = 'Size' in the Map, which itself is stored with the key = 'Buffer' in the top level
of the context.
|
Method Summary | |
public Object | getMandatoryObject(String pContextPath) Returns object with specified path name. | public String | getMandatoryString(String pContextPath) Returns string with specified path name. | public Object | getObject(String pContextPath, Object pDefaultObject) Returns object with specified path name or supplied default object, if
object with this name is not found in context.
Parameters: pContextPath - the path to the object we are looking for Parameters: pDefaultObject - the object to return if object has not been found in context exception: JavaTemplateException - thrown when any technical problems have occured during the lookup. | public String | getString(String pContextPath, String pDefaultString) Returns string with specified path name or supplied default string, if
string with this name is not found in context. |
getMandatoryObject | public Object getMandatoryObject(String pContextPath) throws JavaTemplateException(Code) | | Returns object with specified path name. If object not found
it throws JavaTemplateException with an appropriate message.
Parameters: pContextPath - the path to the string we are looking for exception: JavaTemplateException - thrown when mandatory object has not been found or anytechnical problems have occured during the lookup. |
getMandatoryString | public String getMandatoryString(String pContextPath) throws JavaTemplateException(Code) | | Returns string with specified path name. If string not found
it throws JavaTemplateException with an appropriate message.
This method will basically find an object in exact same way as getMandatoryObject() does and
than return toString() from it.
Parameters: pContextPath - the path to the string we are looking for exception: JavaTemplateException - thrown when mandatory string has not been found or anytechnical problems have occured during the lookup. |
getObject | public Object getObject(String pContextPath, Object pDefaultObject) throws JavaTemplateException(Code) | | Returns object with specified path name or supplied default object, if
object with this name is not found in context.
Parameters: pContextPath - the path to the object we are looking for Parameters: pDefaultObject - the object to return if object has not been found in context exception: JavaTemplateException - thrown when any technical problems have occured during the lookup. |
getString | public String getString(String pContextPath, String pDefaultString) throws JavaTemplateException(Code) | | Returns string with specified path name or supplied default string, if
string with this name is not found in context. This method will basically
find an object in exact same way as getObject() does and than return toString() from it.
Parameters: pContextPath - the path to the string we are looking for Parameters: pDefaultString - the string to return if string has not been found in context exception: JavaTemplateException - thrown when any technical problems have occured during the lookup. |
|
|