Myra Codec Quickstart
Early Development Notice
All MVP.Express projects are currently in active development (pre-1.0.0) and should not be used in production environments. APIs may change without notice, and breaking changes are expected until each project reaches version 1.0.0. We welcome early adopters and contributors, but please use at your own risk.
Achieve zero-GC serialization with schema-driven code generation.
Prerequisites
- Java 24+ with preview features enabled
- Gradle 8.5+ or Maven 3.9+
Installation
Add to your build.gradle.kts:
plugins {
id("express.mvp.myra-codegen") version "0.2.1"
}
dependencies {
implementation("express.mvp.myra:myra-codec:0.2.1")
}
myraCodegen {
schemaDir = file("src/main/resources/schemas")
outputDir = file("build/generated/myra")
}
Define Your Schema
Create src/main/resources/schemas/order.myra.yml:
namespace: com.example.trading
version: 1
types:
Order:
fields:
- name: orderId
type: int64
- name: symbol
type: string
maxLength: 8
- name: price
type: decimal
precision: 18
scale: 8
- name: quantity
type: int32
- name: side
type: enum
values:
- name: timestamp
type: int64
Generate Code
This generates:
OrderBuilder- Flyweight writer for encodingOrderFlyweight- Zero-copy reader for decoding
Encode Data
;
;
try
Decode Data
;
var flyweight ;
flyweight.;
// Zero-copy access - no allocations!
long orderId ;
Utf8View symbol ; // Returns view, not String
long price ;
int quantity ;
JVM Arguments
Next Steps
- Schema Reference - Complete schema syntax
- User Guide - Advanced patterns
- API Reference - Generated code documentation