Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Twister

Convert Avro and Protobuf bytes and objects to and from Java POJOs.

FromToSupported
Avro Record bytesMap POJOs✅️
Avro Record objectsMap wrapper✅️
Map POJOsAvro Record bytes✅️
Map POJOsAvro Schema✅️
Map POJOsProtobuf Descriptor✅️
Map POJOsProtobuf Message bytes✅️
Protobuf Message bytesMap POJOs✅️
Protobuf Message objectsMap 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:

  1. Use a single data model like Proto, Avro, or JSON. This is too rigid for users.
  2. 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

  1. Bi-directional: Twister converts both ways - you can convert Avro and Protobuf data to Java POJOs and vice versa.

  2. Efficient: Twister encodes and decodes data to and from Java POJOs efficiently, without using Avro record or Protobuf message classes.

  3. Wrappers: If you already use records or messages, you can use Twister’s wrapper classes to treat them as POJOs without any performance penalty.

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