Overview
This example demonstrates nested, repeated fields by building a portfolio that contains multiple legs. It also shows repeated string tags, binary attachments, and an optional comment field.
Clone and run
-
Install Java 25 and Git, then confirm the toolchain.
java --version -
Clone the examples repository.
git clone https://github.com/mvp-express/examples.git -
Move into the portfolio example folder.
cd examples/myra-codec-portfolio -
Generate sources and the lock file.
./gradlew codegen -
Run the demo app.
./gradlew run
If you are on Windows, use gradlew.bat instead of ./gradlew.
Concepts highlighted
- Nested repeated messages for portfolio legs.
- Enum decoding via
Sideand presence checks for optional comment. - Repeated string tags accessed with
Utf8Viewfor zero copy reads. - Binary attachments encoded as byte arrays and decoded from MemorySegments.
- Builder and flyweight workflow over pooled MemorySegments.
Files to explore
src/main/resources/schemas/portfolio.myra.ymlsrc/main/java/express/mvp/myra/codec/examples/PortfolioExampleApp.java