|
||||||||||||
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(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 | |
---|---|
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. |
org.eclipse.emf.common.util.Diagnostic |
getLogAsMultiStatus()
Return all logged messages for the transformation as a multi-status IStatus object. |
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 |
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 java.lang.String getJETBundleId()
null
if not defined.JET2Context.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.JET2Context.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 org.eclipse.emf.common.util.Diagnostic getLogAsMultiStatus()
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 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 |