|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jet.JET2Context
Define the execution context for a JET2 transform or template.
Constructor Summary | |
JET2Context(Object source)
Create a JET2 context with the specified source argument and no variables. |
|
JET2Context(Object source,
Map variables)
Create a JET2 context with the specified source argument and the specified variables. |
Method Summary | |
Map |
extractVariables(String variableNames)
Extract a list of variables from the context |
String |
getJETBundleId()
Return the id of the JET Bundle defining the current template. |
org.eclipse.emf.common.util.Diagnostic |
getLogAsMultiStatus()
Return all logged messages for the transformation as a multi-status IStatus object. |
Object |
getSource()
Return the source object for the transformation. |
TagFactory |
getTagFactory()
|
String |
getTemplatePath()
Return the path for the executing template. |
Object |
getVariable(String var)
Return the value of a context variable |
Map |
getVariables()
Return a map of all variables currently defined in the context. |
boolean |
hasContextExtender(Class extenderClass)
Test whether the context has an extender of the pass class. |
boolean |
hasVariable(String var)
Test whether a variable is defined |
void |
logError(String message)
Log an error message |
void |
logError(String templatePath,
TagInfo tagInfo,
String message,
Throwable e)
Log an error on the pass template |
void |
logError(String message,
Throwable e)
Deprecated. Please don't use, will be removed... |
void |
logError(TagInfo tagInfo,
String message,
Throwable exception)
Log an error from the specified tag. |
void |
logError(Throwable e)
Log an exeception that occurred during execution |
void |
logInfo(String message)
Log an informational message |
void |
logWarning(String message)
Log a warning message |
void |
removeVariable(String var)
Remove a variable |
void |
restoreVariables(Map savedVariableValues)
Restore variables in the passed map to the context. |
void |
setJETBundleId(String jetBundleId)
Set the id of the JET Bundle defining the current template. |
void |
setSource(Object source)
Set the source object for the transformation |
void |
setTagFactory(TagFactory tagFactory)
|
void |
setTemplatePath(String templatePath)
Set the templatePath. |
void |
setVariable(String var,
Object value)
Assigne or create a variable, and set its value. |
void |
setVariables(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(Object source, Map variables)
source
- the source objectvariables
- A map public JET2Context(Object source)
This is exactly equivalent to:
JET2Context(source, Collections.EMPTY_MAP)
source
- the source objectMethod Detail |
public void setSource(Object source)
source
- public Object getSource()
public String getJETBundleId()
null
if not defined.JET2Context.setJETBundleId(String)
public void setJETBundleId(String jetBundleId)
jetBundleId
- the JET Bundle ide.public void logInfo(String message)
message
- public String getTemplatePath()
null
if no templatePath is defined.JET2Context.setTemplatePath(String)
public void setTemplatePath(String templatePath)
templatePath
- the template path or null
to indicate no executing template.public void logWarning(String message)
message
- public void logError(String message)
message
- public void logError(Throwable e)
e
- public void logError(String message, Throwable e)
message
- e
- public org.eclipse.emf.common.util.Diagnostic getLogAsMultiStatus()
public void logError(TagInfo tagInfo, String message, Throwable exception)
tagInfo
- message
- the error message to display, or null
exception
- public boolean hasContextExtender(Class extenderClass)
extenderClass
- the extender class
true
if the context has a registered extender of the passed class.public void logError(String templatePath, TagInfo tagInfo, String message, Throwable e)
templatePath
- tagInfo
- message
- e
- public void setVariable(String var, Object value) throws JET2TagException
var
- the variable name. Cannot be null
.value
- the variable value.
JET2TagException
public Object getVariable(String var) throws JET2TagException
var
- the variable name
JET2TagException
- if the variable does not exist.public Map getVariables()
public void removeVariable(String var) throws JET2TagException
var
- the variable name
JET2TagException
public boolean hasVariable(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 Map extractVariables(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(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(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 |