Releases: inferred/FreeBuilder
v1.14
This release adds support for SortedSet properties.
interface RecordShop {
SortedSet<Record> records();
class Builder extends RecordShop_Builder() {
public Builder() {
// Sorted sets default to natural ordering. If this isn't correct,
// you can replace the comparator before adding values.
setComparatorForRecords((a, b) -> a.name().compareTo(b.name()));
}
}
}
v1.13.3
v1.13.2
v1.13.1
As of this release, FreeBuilder no longer erroneously declares dependencies to be pulled in at compile time. (We shade all our dependencies to avoid unnecessary version conflicts with other libraries.)
v1.13
Declare an abstract toBuilder()
method, and FreeBuilder will now implement it. Unlike Builder.from(x), this supports modify-rebuild on partials, allowing users to write robust tests of transform code, which would previously throw UnsupportedOperationExceptions if given a partial.
Person partialJoe = new Person.Builder().name("Joe").buildPartial();
Person.Builder.from(partialJoe); // This will throw an UnsupportedOperationException
partialJoe.toBuilder().name("Bob").build(); // This will return another partial
Additionally, this release fixes a bug triggered when attempting to use a Multiset in a GWT-compatible value type (#231).
v1.12.3
This release uses the latest release of google-java-format, v1.2.
v1.12.2
This release fixes a regression introduced in v1.10.6 which generated uncompilable code for generic value types containing a collection of parameters (e.g. List<E>
where E
is a parameter of the value type; see #229), as well as a long-standing bug in the same circumstances triggered only when Guava is not available (#178).
v1.12.1
v1.12
Generated addAllX
methods are now overridden to accept Streams and Spliterators on Java 8.
v1.11
FreeBuilder no longer requires a 'get' prefix on all getter methods, and will drop the 'set' prefix on its setters to follow suit. Existing FreeBuilder types will be unaffected.
@FreeBuilder
public interface Person {
String name();
int age();
class Builder extends Person_Builder { }
}
Person bob = new Person.Builder().name("Bob").age(25).build();