Java Reference
In-Depth Information
Xpand workflow provides two beautifiers, specified using
org.eclipse.
xpand2.output.JavaBeautifier
and
org.eclipse.xpand2.output.
XmlBeautifier
. You enter these into your Generator elements, as shown in the
following example:
<
outlet
path="src-gen">
<
postprocessor
class="org.eclipse.m2t.xpand.output.JavaBeautifier"
configFile="config/org.eclipse.jdt.core.prefs"
</
outlet
>
The Java post-processor uses the JDT's code formatter and picks up prefer-
ences as long as they are found in the classpath. To create a preferences file for
use in your post processor, enable project-specific settings in
Preferences
→
Java
Formatter
and save the file into the path specified in your
configFile
attribute.
The XML post-processor provides default support for
.xml
,
.xsl
,
.wsdd
,
and
.wsdl
file extensions. Use the
fileExtensions
attribute to add alternate
extensions.
If you are generating something other than Java or XML, you can create
your own post-processor by implementing the
org.eclipse.m2t.xpand.
output.PostProcessor
interface. When deploying the provided or custom
processors, be sure to include the required dependencies to your plug-in.
→
Code Style
→
Aspects
To use the aspect-oriented features of Xpand or Xtend when invoking the gen-
erator, you need to configure them in your workflow. As you might recall from
Section 14.1.12, “AROUND,” which covered using
«AROUND»
in templates, the
workflow used to leverage aspects must be made aware of them. Following is
the workflow file used to invoke the
mindmap2csv.xpt
template, including the
advices defined in
aspects::mindmap2csv.xpt
:
<?xml version="1.0"?>
<
workflow
>
<
cartridge
file="mapsample.mwe" inheritAll="true"/>
<
component
class="org.eclipse.xpand2.GeneratorAdvice"
id="reflectionAdvice" adviceTarget="generate">
<
advices
value="aspects::mindmap2csv"/>
</
component
>
</
workflow
>
Search WWH ::
Custom Search