Skip to content
bobvawter edited this page Jun 27, 2012 · 6 revisions

FlatPack Code Generation

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.

Maven users

<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.

Adding a dialect

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.Dialect file that contains the fully-qualified name of your dialect class
  • Run FastTool --dialect YourDialect or if using Maven, add a <dependency> to the <plugin> and add <dialect>YourDialect</dialect> in the <configuration>.

Clone this wiki locally