Thriving Thriving Java JV
↑ 48 ?
telescope eschizoid/telescope

Optics-based DSL for Java records and POJOs. One type for deep navigation, immutable update, bidirectional mapping, and effects across records + plain POJOs + Lombok. Optional compile-time codegen.

https://central.sonatype.com/artifact/io.github.eschizoid/telescope-core β†—
HEALTH ? 98 / Healthy
// solo builder// hidden gem annotation-processorcodegendeep-copydslfunctional-programmingimmutablejavalenslombokoptics ?

// readme

telescope

Telescope is the mapping layer between the REST, service and entity layers of a JVM service.

A service usually holds the same data three times: as the wire DTO a REST endpoint reads and writes, as the domain type the service works with, and as the entity it persists. Telescope gives each hop between two of those layers one typed mapper. You write the mapper as an ordinary Java expression with method references instead of strings, the compiler checks every field it names, and an annotation processor turns it into plain Java. That generated code runs in about MapStruct’s time on the benchmarks below.

public record Invoice(String id, Customer customer, long totalCents, String internalNote) {
  @Bridge
  static final ForwardMapper<Invoice, InvoiceDto> DTO = mapperForward(
    Invoice.class,
    InvoiceDto.class,
    // a renamed field
    to(Invoice::id, InvoiceDto::number),
    // a field read through a nested object
    to(path(Invoice::customer, Customer::email), InvoiceDto::billTo),
    // a field built from the whole invoice
    compute(InvoiceDto::total, Money::format),
    // a field left out on purpose
    drop(Invoice::internalNote)
  );

  public…