|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jet.JET2Context
public final class JET2Context
Define the execution context for a JET2 transform or template.
Nested Class Summary | |
---|---|
static interface |
JET2Context.LogListener
Protocol for a listener to the JET2Context log. |
Constructor Summary | |
---|---|
JET2Context(java.lang.Object source)
Create a JET2 context with the specified source argument and no variables. |
|
JET2Context(java.lang.Object source,
java.util.Map variables)
Create a JET2 context with the specified source argument and the specified variables. |
Method Summary | |
---|---|
void |
addLogListener(JET2Context.LogListener listener)
Add a listener to context logging entries. |
void |
addPrivateData(java.lang.String key,
java.lang.Object value)
Add private data to the context. |
java.util.Map |
extractVariables(java.lang.String variableNames)
Extract a list of variables from the context |
java.lang.String |
getJETBundleId()
Return the id of the JET Bundle defining the current template. |
ContextLogEntry |
getLogEntries()
|
java.lang.Object |
getPrivateData(java.lang.String key)
Return private data associated with the key. |
java.lang.Object |
getSource()
Return the source object for the transformation. |
TagFactory |
getTagFactory()
|
java.lang.String |
getTemplatePath()
Return the path for the executing template. |
java.lang.Object |
getVariable(java.lang.String var)
Return the value of a context variable |
java.util.Map |
getVariables()
Return a map of all variables currently defined in the context. |
boolean |
hasContextExtender(java.lang.Class extenderClass)
Test whether the context has an extender of the pass class. |
boolean |
hasVariable(java.lang.String var)
Test whether a variable is defined |
void |
logError(java.lang.String message)
Log an error message |
void |
logError(java.lang.String templatePath,
TagInfo tagInfo,
java.lang.String message,
java.lang.Throwable e)
Log an error on the pass template |
void |
logError(java.lang.String message,
java.lang.Throwable e)
Deprecated. Please don't use, will be removed... |
void |
logError(TagInfo tagInfo,
java.lang.String message,
java.lang.Throwable exception)
Log an error from the specified tag. |
void |
logError(java.lang.Throwable e)
Log an exeception that occurred during execution |
void |
logInfo(java.lang.String message)
Log an informational message |
void |
logWarning(java.lang.String message)
Log a warning message |
void |
removeLogListener(JET2Context.LogListener listener)
Remove a previously registerd listener from the context log. |
void |
removePrivateData(java.lang.String key)
Remove private data associated with the key. |
void |
removeVariable(java.lang.String var)
Remove a variable |
void |
restoreVariables(java.util.Map savedVariableValues)
Restore variables in the passed map to the context. |
void |
setJETBundleId(java.lang.String jetBundleId)
Set the id of the JET Bundle defining the current template. |
void |
setSource(java.lang.Object source)
Set the source object for the transformation |
void |
setTagFactory(TagFactory tagFactory)
|
void |
setTemplatePath(java.lang.String templatePath)
Set the templatePath. |
void |
setVariable(java.lang.String var,
java.lang.Object value)
Assigne or create a variable, and set its value. |
void |
setVariables(java.util.Map variablesToPass)
Set the context variables to only the variables in variablesToPass |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JET2Context(java.lang.Object source, java.util.Map variables)
source
- the source objectvariables
- A map public JET2Context(java.lang.Object source)
This is exactly equivalent to:
JET2Context(source, Collections.EMPTY_MAP)
source
- the source objectMethod Detail |
---|
public void setSource(java.lang.Object source)
source
- public java.lang.Object getSource()
public void addLogListener(JET2Context.LogListener listener)
listener
- a log listenerpublic void removeLogListener(JET2Context.LogListener listener)
addLogListener(org.eclipse.jet.JET2Context.LogListener)
has no effect.
listener
- a log listenerpublic java.lang.String getJETBundleId()
null
if not defined.setJETBundleId(String)
public void setJETBundleId(java.lang.String jetBundleId)
jetBundleId
- the JET Bundle ide.public void logInfo(java.lang.String message)
message
- public java.lang.String getTemplatePath()
null
if no templatePath is defined.setTemplatePath(String)
public void setTemplatePath(java.lang.String templatePath)
templatePath
- the template path or null
to indicate no executing template.public void logWarning(java.lang.String message)
message
- public void logError(java.lang.String message)
message
- public void logError(java.lang.Throwable e)
e
- public void logError(java.lang.String message, java.lang.Throwable e)
message
- e
- public ContextLogEntry getLogEntries()
public void logError(TagInfo tagInfo, java.lang.String message, java.lang.Throwable exception)
tagInfo
- message
- the error message to display, or null
exception
- public boolean hasContextExtender(java.lang.Class extenderClass)
extenderClass
- the extender class
true
if the context has a registered extender of the passed class.public java.lang.Object getPrivateData(java.lang.String key)
key
- a private data key.
null
if not data is associate with the key.public void addPrivateData(java.lang.String key, java.lang.Object value)
key
- the key for the private datavalue
- the data value
java.lang.IllegalStateException
- if key
has already been used to add private data.
java.lang.NullPointerException
- if value
or key
is null
.getPrivateData(String)
public void removePrivateData(java.lang.String key)
key
- the key for the private datapublic void logError(java.lang.String templatePath, TagInfo tagInfo, java.lang.String message, java.lang.Throwable e)
templatePath
- tagInfo
- message
- e
- public void setVariable(java.lang.String var, java.lang.Object value) throws JET2TagException
var
- the variable name. Cannot be null
.value
- the variable value.
JET2TagException
public java.lang.Object getVariable(java.lang.String var) throws JET2TagException
var
- the variable name
JET2TagException
- if the variable does not exist.public java.util.Map getVariables()
public void removeVariable(java.lang.String var) throws JET2TagException
var
- the variable name
JET2TagException
public boolean hasVariable(java.lang.String var)
var
- the variable name
true
if defined, false
otherwise.public final TagFactory getTagFactory()
public final void setTagFactory(TagFactory tagFactory)
tagFactory
- the tagFactory to setpublic java.util.Map extractVariables(java.lang.String variableNames) throws JET2TagException
variableNames
- a comma separated list of variables. May be null
.
null
if variableNames
is null
.
JET2TagException
- if variableNames
contains an invalid variable name.public void restoreVariables(java.util.Map savedVariableValues) throws JET2TagException
savedVariableValues
- a Map keyed by variable name. If null
the method does nothing.
JET2TagException
- if a variable name is invalidpublic void setVariables(java.util.Map variablesToPass) throws JET2TagException
variablesToPass
- a non-null map keyed by variable name.
JET2TagException
- if a variable name is invalid
|
Copyright 2006 IBM Corporation and others. All Rights Reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |