Twister
Convert Avro and Protobuf bytes and objects to and from Java POJOs.
From | To | Supported |
---|---|---|
Avro Record bytes | Map POJOs | ✅️ |
Avro Record objects | Map wrapper | ✅️ |
Map POJOs | Avro Record bytes | ✅️ |
Map POJOs | Avro Schema | ✅️ |
Map POJOs | Protobuf Descriptor | ✅️ |
Map POJOs | Protobuf Message bytes | ✅️ |
Protobuf Message bytes | Map POJOs | ✅️ |
Protobuf Message objects | Map wrapper | ✅️ |
About Twister
Twister is an open-source project that converts between Avro and Protobuf bytes and objects and Java Plain Old Java Objects (POJOs).
Libraries that process data must have a data model. Library developers are forced to pick:
- Use a single data model like Proto, Avro, or JSON. This is too rigid for users.
- Make the data model pluggable. This is cumbersome for users.
Twister allows developers to use standard Java objects in their code, and convert them to and from Avro, Protobuf, or JSON data types under the hood.
Features
Bi-directional: Twister converts both ways - you can convert Avro and Protobuf data to Java POJOs and vice versa.
Efficient: Twister encodes and decodes data to and from Java POJOs efficiently, without using Avro record or Protobuf message classes.
Wrappers: If you already use records or messages, you can use Twister’s wrapper classes to treat them as POJOs without any performance penalty.
Easy: Twister is designed with simplicity in mind. Its API is clean, straightforward, and easy to use.
Getting Started
Add Twister to your Maven pom.xml:
<dependencies>
<dependency>
<groupId>dev.twister</groupId>
<artifactId>twister-avro</artifactId>
<version>0.2.0</version>
</dependency>
<dependency>
<groupId>dev.twister</groupId>
<artifactId>twister-proto</artifactId>
<version>0.2.0</version>
</dependency>
</dependencies>
Or build.gradle:
dependencies {
implementation 'dev.twister:twister-avro:0.2.0'
implementation 'dev.twister:twister-proto:0.2.0'
}
And check out the documentation!