Java Reference
In-Depth Information
If you want to export an extension used in a file with your own extensions,
add the reexport keyword to the end of the extension statement.
extension org::eclipse::mindmap::Util reexport ;
Comments
Comments in Xtend come in two flavors: single line and multiline. Single-line
comments are like those in Java: two forward slashes ( // ) demark the start of a
comment that goes until the end of the line.
// An example single line comment
A multiline comment is also like comments in Java, with /* marking the start
and */ marking the end of comments that can span multiple lines.
/*
* A multi-line comment.
*/
Extensions
The basic syntax for an extension expression indicates an optional return type,
extension name, parameter list, and expression body following a single colon and
terminated with a semicolon. Following is the general syntax.
ReturnType expressionName( ParamType1 param1, …) : expression-body;
Consider this simple example that returns a standard setter method name for
a passed element:
String setterName( NamedElement element) : 'set' +
element.name.toFirstUpper();
Extension Invocation
You can invoke an extension in two ways. The first is by passing the element
instance as a parameter, as shown here:
setterName(myFeature);
Search WWH ::




Custom Search