Overview
This document describes programming language-independent, e.g.:- Java to C++,
- Java to Python,
- Java to Java
Installing Thrift Compiler
On Debian Linux:
apt-get install thrift-compiler
On Mac:
$ brew install thrift
==> Installing thrift dependency: boost...==>
Summary /usr/local/Cellar/thrift/0.9.1: 89 files, 4.8M, built in 2.8 minutes
Creating Thrift Definition File
namespace java com.company.project.thrift
service MyService {
bool enableMethod();
bool disableMethod();
}
Generate Sources from Thrift Definition File
$ thrift --gen java -out gen ./src/main/thrift/definition_file.thrift
This line tells Thrift
- --gen java - generate Java files (change for C++, etc.)
- -out gen - put output files in "gen" folder
- ./src... .thrift - use this definition file