This project allows generating infix extension functions for instance methods with multiple parameters.
For example, by annotating the createBy
instance method with the @Infix
annotation,
class ClientService {
// intermediate methods' names are customizable (default = "and")
@Infix("createWithName", "age", "andHeight")
fun createBy(name: String, age: Int, height: Int) = "Carl"
}
the ClientService
can be used in a DSL fashion:
clientService createWithName "Alex" age 23 andHeight 170
Such notation adopts the codebase to the DDD, allowing reading the code as sentences in a context of the domain.
This project is available on the Maven Central repository.
Add this to your project's build.gradle
:
dependencies {
implementation 'com.driver733.infix-functions-generator:annotation:2.0.1'
annotationProcessor 'com.driver733.infix-functions-generator:processor:2.0.1'
}
-
Apply the
KAPT
plugin.plugins { id("org.jetbrains.kotlin.kapt") version "1.3.72" }
-
Add this to your project's
build.gradle.kts
:dependencies { implementation("com.driver733.infix-functions-generator:annotation:2.0.1") kapt("com.driver733.infix-functions-generator:processor:2.0.1") }
Add this to your project's pom.xml
:
<dependencies>
<dependency>
<groupId>com.driver733.infix-functions-generator</groupId>
<artifactId>annotations</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>com.driver733.infix-functions-generator</groupId>
<artifactId>processor</artifactId>
<version>2.0.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
JDK, preferably >= v. 1.8
./gradlew clean build
Github actions is used for CI/CD.
Releases to the Maven Central repository are automatically made on each commit on the master branch with the help of the semantic-release.
- Create an issue and describe your problem/suggestion in it.
- Submit a pull request with a reference to the issue that the pull request closes.
- I will review your changes and merge them.
- A new version with your changes will be released automatically right after merging.
We use SemVer for versioning. For the versions available, see the tags.
- Mikhail @driver733 Yakushin - Initial work
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE.md file for details.