-
Notifications
You must be signed in to change notification settings - Fork 2
CodeGeneration
bobvawter edited this page Aug 23, 2012
·
6 revisions
Code-generation for client libraries is provided by FastTool, the FlatPack Automatic Source Tool, located in the flatpack-fast module. There's also a maven plugin, flatpack-fast-maven-plugin.
To get started, see DemoResource for how to generate an ApiDescription. The description serves as the input to FastTool and is used to generate client API access libraries using pluggable dialects.
- Java via
--dialect java - Ruby via
--dialect rb
mvn org.apache.maven.plugins:maven-dependency-plugin:2.4:get \
-Dartifact=com.getperka.flatpack:flatpack-fast:RELEASE:jar:shaded \
-Ddest=fast.jar
java -jar fast.jar help --showAll<plugin>
<groupId>com.getperka.flatpack</groupId>
<artifactId>flatpack-fast-maven-plugin</artifactId>
<version>${flatpack.version}</version>
<configuration>
<source>src/main/flatpack/apiDescription.js</source>
<packageName>com.example.client</packageName>
</configuration>
<executions>
<execution>
<goals>
<goal>fast</goal>
</goals>
</execution>
</executions>
</plugin>See demo-client/pom.xml for a complete example.
TODO(bobvawter): Expand this once additional language plugins are done.
- Create a project that depends on
flatpack-fast - Write an implementation of
Dialect - Add
src/main/resources/META-INF/com.getperka.flatpack.fast.Dialectfile that contains the fully-qualified name of your dialect class - Run
FastTool --dialect YourDialector if using Maven, add a<dependency>to the<plugin>and add<dialect>YourDialect</dialect>in the<configuration>.