Very, very, lightweight dynamic-class-based immutable value types for Java 8.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
gradle/wrapper
src
.gitignore
LICENSE
README.adoc
build.gradle
gradlew
gradlew.bat
settings.gradle

README.adoc

Very, very, lightweight dynamic-class-based immutable value types for Java 8.

You don’t actually want this. It’s more or less a fanwork based on the canon of Dominic Fox’s endless stream of attempts to bring structs to Java. It is not the first.

Define types as follows:

public interface Address extends Struct<Address> {
    Collection<String> addressLines();
    String postcode();
}
public interface Person extends Struct<Person> {
    String name();
    int age();
    Address address();
}

Build values like this:

Person person = Struct.of(Person.class);

Read properties like this:

int age = person.age();

At the moment, you can’t actually create structs whose properties have non-zero values, or update structs in any way. Rest assured that this is the project’s highest priority. After that we’ll get on to lenses and destructors and Q-algebras and all that.