public class TemplateTranslator extends Object
TemplateVariables.
The EBNF grammar of a valid string is as follows:
template := (text | escape)*.
text := character - dollar.
escape := dollar ('{' variable '}' | dollar).
dollar := '$'.
variable := identifier | identifier ':' type.
type := qualifiedname | qualifiedname '(' arguments ')'.
arguments := (argument ',')* argument.
argument := qualifiedname | argumenttext.
qualifiedname := (identifier '.')* identifier.
argumenttext := "'" (character - "'" | "'" "'")* "'".
identifier := javaidentifierpart - "$".
Clients may only replace 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)
Deprecated.
as of 3.3 use
createVariable(TemplateVariableType, String, int[]) instead |
protected TemplateVariable |
createVariable(TemplateVariableType 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.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.TemplateException - if translation failedgetErrorMessage()protected TemplateVariable createVariable(String type, String name, int[] offsets)
createVariable(TemplateVariableType, String, int[]) insteadClients 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 templateTemplateVariableprotected TemplateVariable createVariable(TemplateVariableType 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 templateTemplateVariable
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.