Commit Graph

185 Commits

Author SHA1 Message Date
Jordan Zimmerman
7248bad2bd [maven-release-plugin] prepare release record-builder-30 record-builder-30 2022-01-25 10:59:45 +00:00
Jordan Zimmerman
7e494d8753 Optional functional methods for With
When enabled, some functional methods are added to the `With` nested
class.

E.g.

```java
@RecordBuilder
record MyRecord<T>(String name, T value, int qty) implements MyRecordBuilder.With<T> {}

...

MyRecord<Thing> r = ...

var other = r.map((name, value, qty) -> new Other(...));
```
2022-01-22 09:17:15 +00:00
Madis Pärn
3954499d4b Allow components stream method to work with null fields (#85)
Co-authored-by: Madis Parn <madis.parn@topia.com>
2022-01-22 07:56:39 +00:00
Jordan Zimmerman
13959dee2a [maven-release-plugin] prepare for next development iteration 2021-11-03 08:51:54 +00:00
Jordan Zimmerman
af759c0570 [maven-release-plugin] prepare release record-builder-29 record-builder-29 2021-11-03 08:51:47 +00:00
Jordan Zimmerman
9a7d73e78c Support options on includes 2021-11-03 08:44:51 +00:00
Jordan Zimmerman
3b8c3ff9e3 Remove Java 15 support
Java 15 has been EOL for a while now. No need to continue supporting
it.

Closes #78
2021-10-21 19:00:46 +01:00
Jordan Zimmerman
9943667af1 Add support for static from() that returns a Wither
Useful for when you can't add the With interface to your record.
Static method takes a record as an argument and returns a With
instance.
2021-10-19 20:24:10 +01:00
Stefan Kuhn
b0c8f10711 fix: build 2021-10-19 19:42:04 +01:00
Stefan Kuhn
0d3c2f37c1 chore: update test to use annotation processor discovery 2021-10-19 19:42:04 +01:00
Stefan Kuhn
eabcb2f179 doc: update maven usage, so that the default annotation processors discovery process is not disabled 2021-10-19 19:42:04 +01:00
Jordan Zimmerman
5fef81191d [maven-release-plugin] prepare for next development iteration 2021-10-07 10:14:58 +01:00
Jordan Zimmerman
8dbec027e4 [maven-release-plugin] prepare release record-builder-28 record-builder-28 2021-10-07 10:14:53 +01:00
Jordan Zimmerman
ef09d68b78 [maven-release-plugin] prepare for next development iteration 2021-10-07 10:11:59 +01:00
Jordan Zimmerman
0a608f3b20 [maven-release-plugin] prepare release record-builder-27-java15 record-builder-27-java15 2021-10-07 10:11:54 +01:00
Jordan Zimmerman
3494d01b2b Added link to SingleItemsBuilder gist 2021-10-07 08:35:46 +01:00
Jordan Zimmerman
584bdf4a25 Support single item collection builders
When `addSingleItemCollectionBuilders()` is enabled in options, collection types (`List`, `Set` and `Map`)
are handled specially. The setters for these types now create an internal collection and
items are added to that collection. Additionally, "adder" methods prefixed with
`singleItemBuilderPrefix()` are created to add single items to these collections.

Closes #73
2021-10-07 08:35:17 +01:00
Jordan Zimmerman
9268c295fe Add RecordBuilderFull
- Add `@RecordBuilderFull` which will have most optional features enabled
- Change `@RecordBuilder.Template` to be `RetentionPolicy.CLASS`
2021-10-07 08:35:17 +01:00
Jordan Zimmerman
0d2fe2ffe7 Optionally include all records from a list of packages
Closes #67
2021-10-07 08:35:17 +01:00
Jordan Zimmerman
71e22042e9 Add Java 17 build 2021-10-07 08:35:17 +01:00
Jordan Zimmerman
3c8e305002 Use Map.entry() instead of AbstractMap.SimpleEntry
Closes #68
2021-10-07 08:35:17 +01:00
Jordan Zimmerman
76f93039b0 Support options for RecordInterface
- Copy any @RecordBuilder.Options to the generated Record
- Support RecordInterface templates as well

Closes #64
2021-10-07 08:35:17 +01:00
Jordan Zimmerman
5f82af97ae The null check after instanceof Set was unnecessary in the __collection shim 2021-10-07 08:35:17 +01:00
Jordan Zimmerman
896aab18aa Update customizing.md 2021-10-07 08:35:17 +01:00
Jordan Zimmerman
75010d0add Update README.md 2021-10-07 08:35:17 +01:00
Jordan Zimmerman
26a6141bef [maven-release-plugin] prepare for next development iteration 2021-10-07 08:35:17 +01:00
Jordan Zimmerman
cdd9009fa8 [maven-release-plugin] prepare release record-builder-26 2021-10-07 08:35:17 +01:00
Jordan Zimmerman
0624a6caca [maven-release-plugin] prepare for next development iteration 2021-10-07 08:35:17 +01:00
Jordan Zimmerman
238ef872bf [maven-release-plugin] prepare release record-builder-25-java15 2021-10-07 08:35:17 +01:00
Jordan Zimmerman
ef2a3692d1 Match record visibility
If the builder is in the same package as the record and the record
is package-private, make the builder package-private too.

Closes #52
2021-10-07 08:35:17 +01:00
Jordan Zimmerman
cb9ceb0529 @Override should not be inherited. Also, the inheritComponentAnnotations
option was being ignored.

Closes #57
2021-10-07 08:35:17 +01:00
Jordan Zimmerman
bd8fbeb045 Adds special handling for record components of type java.util.List, java.util.Set, java.util.Map and java.util.Collection. When the record is built, any components of these types are passed through an added shim method that uses the corresponding immutable collection (e.g. List.copyOf(o)) or an empty immutable collection if the component is null.
Closes #56
Closes #58
2021-10-07 08:35:17 +01:00
Jordan Zimmerman
5b10284d4e [maven-release-plugin] prepare for next development iteration 2021-10-07 08:35:17 +01:00
Jordan Zimmerman
49a19ca8f8 [maven-release-plugin] prepare release record-builder-24 2021-10-07 08:35:17 +01:00
Jordan Zimmerman
f9fcd1e540 [maven-release-plugin] prepare for next development iteration 2021-10-07 08:35:17 +01:00
Jordan Zimmerman
eebb2b2bfd [maven-release-plugin] prepare release record-builder-23-java15 2021-10-07 08:35:17 +01:00
Jordan Zimmerman
67f219bd67 Remove downcast in favor of methods
Great suggestion from @Twisol. There's no need for the downcasting
if record component methods are added to the Wither interface.

Closes #27
2021-10-07 08:35:17 +01:00
Jordan Zimmerman
d9f27bc5a6 Validation and null checks are missing for withers. This PR adds them.
Closes #47
2021-10-07 08:35:17 +01:00
Jordan Zimmerman
f7b6f47bbf [maven-release-plugin] prepare for next development iteration 2021-10-07 08:35:17 +01:00
Jordan Zimmerman
7e90e64988 [maven-release-plugin] prepare release record-builder-22 2021-10-07 08:35:17 +01:00
Jordan Zimmerman
cbe3b7cef4 [maven-release-plugin] prepare for next development iteration 2021-10-07 08:35:17 +01:00
Jordan Zimmerman
6c15bdd825 [maven-release-plugin] prepare release record-builder-21 2021-10-07 08:35:17 +01:00
Jordan Zimmerman
53aaf6b7e9 [maven-release-plugin] prepare for next development iteration 2021-10-07 08:35:17 +01:00
Jordan Zimmerman
09ed5905e3 [maven-release-plugin] prepare release record-builder-21-java15 2021-10-07 08:35:17 +01:00
Jordan Zimmerman
41f59e704f Added more unit tests
Closes #36
2021-10-07 08:35:17 +01:00
Jordan Zimmerman
d0c56e6fdf Fix up some minor version/path issues in the POMs 2021-10-07 08:35:17 +01:00
dependabot[bot]
2f3477a1ca Bump hibernate-validator from 6.0.16.Final to 6.0.20.Final
Bumps [hibernate-validator](https://github.com/hibernate/hibernate-validator) from 6.0.16.Final to 6.0.20.Final.
- [Release notes](https://github.com/hibernate/hibernate-validator/releases)
- [Changelog](https://github.com/hibernate/hibernate-validator/blob/6.0.20.Final/changelog.txt)
- [Commits](https://github.com/hibernate/hibernate-validator/compare/6.0.16.Final...6.0.20.Final)

---
updated-dependencies:
- dependency-name: org.hibernate.validator:hibernate-validator
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-07 08:35:17 +01:00
Jordan Zimmerman
091e9493b6 Support Java Validation API
Option to pass created records through the Java Validation API if it's
available in the classpath. IMPORTANT: when enabled, the record-builder-validator
module must also be included. record-builder-validator is written totally
via reflection so if no validation framework is included it's a NOP.
2021-10-07 08:35:17 +01:00
Jordan Zimmerman
a0c03e88cc Add support for NotNull-style annotations
When enabled, annotations matching the configured regex for NotNull
annotations cause `Object.requireNonNull()` to be added for annotated
components.
2021-10-07 08:35:17 +01:00
Jordan Zimmerman
d21953c39a Use manifest based automatic module instead of hand-coded version (#43)
This is much saner. It seems silly to maintain an extra file in the
project when this can all be done via Maven config.
2021-10-07 08:35:17 +01:00