-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: ✨ Immutable Collections Extension added (#107)
feat!: Immutable Collections Extension added closes #106 BREAKING CHANGE: Extensions API changed
- Loading branch information
1 parent
c476bad
commit 0272a02
Showing
149 changed files
with
6,292 additions
and
356 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
titleAndCommits: true |
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,34 @@ | ||
# ARICE API | ||
|
||
Annotations to mark methods in an interface, used during annotation processing with ARICE usage. | ||
|
||
Please, see [WIKI](https://github.com/pawellabaj/auto-record/wiki/ARICE) for information. | ||
|
||
## Usage | ||
|
||
If you use annotation processing in your project, the library will be provided as a dependency of [ARICE](https://github.com/pawellabaj/auto-record/tree/main/arice/extension). | ||
|
||
If you just want to mark your sources (ieg. annotations are being processed in other project or build step), | ||
use `arice-api` directly. | ||
|
||
### Maven | ||
|
||
Add the following dependency to your `pom.xml` file: | ||
|
||
```xml | ||
|
||
<dependency> | ||
<groupId>pl.com.labaj.autorecord</groupId> | ||
<artifactId>arice-api</artifactId> | ||
<version>${arice.version}</version> | ||
</dependency> | ||
``` | ||
|
||
### Gradle | ||
|
||
Declare the following dependency in your `build.gradle` script: | ||
|
||
```groovy | ||
dependencies { | ||
annotationProcessor 'pl.com.labaj.autorecord:arice-api:${ariceVersion}' | ||
} |
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,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>pl.com.labaj.autorecord</groupId> | ||
<artifactId>arice-project</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
<relativePath>../project/pom.xml</relativePath> | ||
</parent> | ||
|
||
<name>ARICE API</name> | ||
|
||
<artifactId>arice-api</artifactId> | ||
</project> |
41 changes: 41 additions & 0 deletions
41
arice/api/src/main/java/pl/com/labaj/autorecord/extension/arice/Mutable.java
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,41 @@ | ||
package pl.com.labaj.autorecord.extension.arice; | ||
|
||
/*- | ||
* Copyright © 2023 Auto Record | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import org.apiguardian.api.API; | ||
|
||
import java.lang.annotation.Inherited; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.Target; | ||
|
||
import static java.lang.annotation.ElementType.METHOD; | ||
import static java.lang.annotation.ElementType.PARAMETER; | ||
import static java.lang.annotation.ElementType.TYPE_PARAMETER; | ||
import static java.lang.annotation.RetentionPolicy.SOURCE; | ||
import static org.apiguardian.api.API.Status.STABLE; | ||
|
||
/** | ||
* Annotates methods in @AutoRecord annotated interface for which the corresponding components in generated record are not relevant | ||
* for copying to immutable collection. | ||
* | ||
* @see <a href="https://github.com/pawellabaj/auto-record/wiki/ARICE">ARICE Wiki</a> | ||
*/ | ||
@Retention(SOURCE) | ||
@Target({METHOD, TYPE_PARAMETER, PARAMETER}) | ||
@Inherited | ||
@API(status = STABLE) | ||
public @interface Mutable {} |
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
Empty file.
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,43 @@ | ||
# ARICE (Auto Record Immutable Collections Extension) | ||
|
||
An implementations of the link AutoRecord extension for customizing a record generation process with support for immutable collections. | ||
|
||
## Documentation | ||
|
||
For more information on how to use ARICE and all its features, please visit the project's [Wiki](https://github.com/pawellabaj/auto-record/wiki/ARICE). | ||
|
||
## Getting started | ||
|
||
### Maven | ||
|
||
Add the following dependency to your `pom.xml` file: | ||
|
||
```xml | ||
<dependency> | ||
<groupId>pl.com.labaj.autorecord</groupId> | ||
<artifactId>auto-record</artifactId> | ||
<version>${auto-record.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>pl.com.labaj.autorecord</groupId> | ||
<artifactId>arice</artifactId> | ||
<version>${arice.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
``` | ||
|
||
### Gradle | ||
|
||
Declare the following dependency in your `build.gradle` script: | ||
|
||
```groovy | ||
dependencies { | ||
annotationProcessor 'pl.com.labaj.autorecord:auto-record:${autoRecordVersion}', | ||
implementation 'pl.com.labaj.autorecord:arice:${ariceVersion}' | ||
} | ||
``` | ||
|
||
### IDE | ||
|
||
Depending on your IDE you are likely to need to enable Annotation Processing in your IDE settings. |
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,35 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>pl.com.labaj.autorecord</groupId> | ||
<artifactId>arice-project</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
<relativePath>../project/pom.xml</relativePath> | ||
</parent> | ||
|
||
<name>ARICE</name> | ||
<description>Auto Record Immutable Collections Extension</description> | ||
<artifactId>arice-extension</artifactId> | ||
|
||
<properties> | ||
<license-maven-plugin.header>${project.basedir}/../../.build/lic-header.txt</license-maven-plugin.header> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>pl.com.labaj.autorecord</groupId> | ||
<artifactId>auto-record</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>pl.com.labaj.autorecord</groupId> | ||
<artifactId>arice-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>pl.com.labaj.autorecord</groupId> | ||
<artifactId>arice-utils</artifactId> | ||
</dependency> | ||
</dependencies> | ||
</project> |
54 changes: 54 additions & 0 deletions
54
arice/extension/src/main/java/pl/com/labaj/autorecord/extension/arice/ARICEUtilities.java
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,54 @@ | ||
package pl.com.labaj.autorecord.extension.arice; | ||
|
||
/*- | ||
* Copyright © 2023 Auto Record | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import org.apiguardian.api.API; | ||
|
||
import java.lang.annotation.Inherited; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.Target; | ||
|
||
import static java.lang.annotation.ElementType.TYPE; | ||
import static java.lang.annotation.RetentionPolicy.SOURCE; | ||
import static org.apiguardian.api.API.Status.MAINTAINED; | ||
|
||
/** | ||
* This annotation is used to mark the generated record, so the ARICE (AutoRecord Immutable Collections Extension) | ||
* knows what utility class it should generate. | ||
* | ||
* @since 3.0.0 | ||
*/ | ||
@Retention(SOURCE) | ||
@Target(TYPE) | ||
@Inherited | ||
@API(status = MAINTAINED) | ||
public @interface ARICEUtilities { | ||
/** | ||
* Specifies the fully qualified name of the utility class that provides additional methods and functionality | ||
* to support the ARICE extension. | ||
* | ||
* @return the fully qualified name of the utility class. | ||
*/ | ||
String className(); | ||
|
||
/** | ||
* Specifies an array of fully qualified names of immutable types. These types will be used in conjunction with the ARICE extension | ||
* | ||
* @return an array of fully qualified names of immutable types. | ||
*/ | ||
String[] immutableTypes() default {}; | ||
} |
Oops, something went wrong.