generated from micronaut-projects/micronaut-project-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from micronaut-projects/add-docs
docs: Add some docs
- Loading branch information
Showing
7 changed files
with
41 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
The module Micronaut SourceGen annotations ships with annotations which you can use in your projects: | ||
|
||
To use them, you need the following dependency: | ||
|
||
dependency:micronaut-sourcegen-annotations[groupId=io.micronaut.sourcegen] | ||
|
||
dependency:micronaut-sourcegen-annotations[groupId=io.micronaut.sourcegen,scope=annotationProcessor] | ||
|
||
[options="header"] | ||
|=== | ||
| Annotation | Description | ||
|
||
| api:sourcegen.annotations.Builder[] | ||
| Create a builder of the annotated type. | ||
|=== | ||
|
||
|
||
If you annotate a Java Record with `@Builder`, a `PersonBuilder` class is generated at compliation-time. | ||
|
||
[source,java] | ||
---- | ||
include::test-suite-java/src/main/java/io/micronaut/sourcegen/example/Person.java[tags=clazz,indent=0] | ||
---- | ||
|
||
You can use a https://blogs.oracle.com/javamagazine/post/exploring-joshua-blochs-builder-design-pattern-in-java[builder pattern] to create a `Person` instance: | ||
|
||
[source,java] | ||
---- | ||
include::test-suite-java/src/test/java/io/micronaut/sourcegen/example/PersonBuilderTest.java[tags=test,indent=0] | ||
---- | ||
|
||
NOTE: The https://github.com/micronaut-projects/micronaut-sourcegen/blob/master/sourcegen-generator/src/main/java/io/micronaut/sourcegen/generator/visitors/BuilderAnnotationVisitor.java[BuilderAnnotationVisitor] is an example of how to use the Micronaut SourceGen API. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
TODO | ||
Micronaut SourceGen exposes a language-neutral API for source code generation. It uses https://github.com/square/javapoet[JavaPoet] internally. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
introduction: | ||
title: Introduction | ||
releaseHistory: Release History | ||
quickStart: | ||
title: Quick Start | ||
annotations: Annotations | ||
repository: Repository | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters