public class TemplateTranslator extends Object
TemplateVariables.
The EBNF grammar of a valid string is as follows:
template := (text | escape)*.
text := character - dollar.
escape := dollar ('{' identifier '}' | dollar).
dollar := '$'.
Clients may extend the createVariable method of this class.
| Constructor and Description |
|---|
TemplateTranslator() |
| Modifier and Type | Method and Description |
|---|---|
protected TemplateVariable |
createVariable(String type,
String name,
int[] offsets)
Hook method to create new variables.
|
String |
getErrorMessage()
Returns an error message if an error occurred for the last translation,
null otherwise. |
TemplateBuffer |
translate(String string)
Translates a template string to
TemplateBuffer. |
TemplateBuffer |
translate(Template template)
Translates a template to a
TemplateBuffer. |
public String getErrorMessage()
null otherwise.null otherwisepublic TemplateBuffer translate(Template template) throws TemplateException
TemplateBuffer. null
is returned if there was an error. getErrorMessage() retrieves the
associated error message.template - the template to translate.null
if there was an error.TemplateException - if translation failedgetErrorMessage()public TemplateBuffer translate(String string) throws TemplateException
TemplateBuffer. null
is returned if there was an error. getErrorMessage() retrieves the
associated error message.string - the string to translate.null
if there was an error.TemplateException - if translation failedgetErrorMessage()protected TemplateVariable createVariable(String type, String name, int[] offsets)
Clients may replace this method.
type - the type of the new variable.name - the name of the new variable.offsets - the offsets where the variable occurs in the templateTemplateVariableGuidelines for using Eclipse APIs. Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.