Skip to content

Caffeinate

Caffeinate is a Java annotation processor that generates implementation classes from annotated interfaces.

Quick Example

Define an interface and annotate it with @Immutable -- Objects generates the implementation class at compile time.

package com.example;

import io.github.joke.caffeinate.Immutable;

@Immutable
public interface Person {
    String getFirstName();
    int getAge();
}
package com.example;

public class PersonImpl implements Person {
    private final String firstName;
    private final int age;

    public PersonImpl(String firstName, int age) {
        this.firstName = firstName;
        this.age = age;
    }

    @Override
    public String getFirstName() {
        return this.firstName;
    }

    @Override
    public int getAge() {
        return this.age;
    }
}

Learn More

  • Getting Started -- installation and setup
  • @Immutable -- generate immutable implementation classes
  • @Mutable -- generate mutable implementation classes with setters
  • Reference -- full annotation and configuration reference