Mapstruct-fluent

Generator of fluent extension functions for mapstruct mappers

Лицензия

Лицензия

Категории

Категории

MapStruct Универсальные библиотеки Bean Mapping
Группа

Группа

com.driver733.mapstruct-fluent
Идентификатор

Идентификатор

common
Последняя версия

Последняя версия

1.1.1
Дата

Дата

Тип

Тип

module
Описание

Описание

Mapstruct-fluent
Generator of fluent extension functions for mapstruct mappers
Ссылка на сайт

Ссылка на сайт

https://github.com/driver733/mapstruct-fluent
Система контроля версий

Система контроля версий

https://github.com/driver733/mapstruct-fluent

Скачать common

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
org.jetbrains.kotlin : kotlin-stdlib-jdk8 jar 1.4.30

runtime (7)

Идентификатор библиотеки Тип Версия
org.jetbrains.kotlin : kotlin-reflect jar 1.4.30
org.jetbrains.kotlinx : kotlinx-coroutines-core-jvm jar 1.4.2
org.jetbrains.kotlinx : kotlinx-coroutines-test jar 1.4.2
com.fasterxml.jackson.module : jackson-module-kotlin jar 2.11.1
org.awaitility : awaitility-kotlin jar 4.0.3
org.mapstruct : mapstruct jar 1.4.2.Final
com.squareup : kotlinpoet jar 1.5.0

Модули Проекта

Данный проект не имеет модулей.

Mapstruct fluent extensions generator

Build Maven Central

semantic-release

Licence

This project provides a generator of fluent extension functions for mapstruct mappers.

Examples

Extension method for the mappers' factory

data class EmployeeModel(val firstName: String? = null)
data class EmployeeView(val firstName: String? = null)
@Mapper
abstract class EmployeeMapper {
    abstract fun toEmployeeView(employeeModel: EmployeeModel): EmployeeView
}
val employee = EmployeeView("Alex")
employee.toEmployeeView() == Mappers.getMapper(EmployeeMapper::class.java).toEmployeeView(employee)

Extension method for the mapper's Spring bean

data class EmployeeModel(val firstName: String? = null)
data class EmployeeView(val firstName: String? = null)
@Mapper(componentmodel = "spring")
abstract class EmployeeMapper {
    abstract fun toEmployeeView(employeeModel: EmployeeModel): EmployeeView
}

Calling the generated extension function

@Service
class Service {
    fun a() {
        val model = EmployeeModel("Alex")
        val view = employee.toEmployeeView()
    }
}

is the same as manually using the mapper's Spring bean

@Service
class Service(
    private val mapper: EmployeeMapper
) {
    fun a() {
        val model = EmployeeModel("Alex")
        val view = mapper.toEmployeeView(employee)
    }
}

Distribution

This project is available on the Maven Central repository.

Getting Started

Install

Gradle

Groovy DSL

Add this to your project's build.gradle:

dependencies {
    annotationProcessor 'com.driver733.mapstruct-fluent:processor:1.0.3'
    implementation 'com.driver733.mapstruct-fluent:processor:1.0.3'
    annotationProcessor 'com.driver733.mapstruct-fluent:processor-spring:1.0.3'
    implementation 'com.driver733.mapstruct-fluent:processor-spring:1.0.3'
}
Kotlin DSL
  1. Apply the KAPT plugin.

    plugins {
      id("org.jetbrains.kotlin.kapt") version "1.3.72"
    }
  2. Add this to your project's build.gradle.kts:

    dependencies {
        kapt("com.driver733.mapstruct-fluent:processor:1.0.3")
        implementation("com.driver733.mapstruct-fluent:processor:1.0.3")
        kapt("com.driver733.mapstruct-fluent:processor-spring:1.0.3")
        implementation("com.driver733.mapstruct-fluent:processor-spring:1.0.3")
    }

Maven

Add this to your project's pom.xml:

<dependencies>
    <dependency>
      <groupId>com.driver733.mapstruct-fluent</groupId>
      <artifactId>processor</artifactId>
      <version>1.0.3</version>
    </dependency>
    <dependency>
      <groupId>com.driver733.mapstruct-fluent</groupId>
      <artifactId>processor-spring</artifactId>
      <version>1.0.3</version>
    </dependency>
</dependencies>
<pluginManagement>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>...</version>
            <configuration>
                <annotationProcessorPaths>
                    <annotationProcessorPath>
                        <groupId>com.driver733.mapstruct-fluent</groupId>
                        <artifactId>processor</artifactId>
                        <version>1.0.3</version>
                    </annotationProcessorPath>
                   <annotationProcessorPath>
                        <groupId>com.driver733.mapstruct-fluent</groupId>
                        <artifactId>processor-spring</artifactId>
                        <version>1.0.3</version>
                    </annotationProcessorPath>
                </annotationProcessorPaths>
            </configuration>
        </plugin>
    </plugins>
</pluginManagement>

Development

Prerequisites

JDK, preferably >= v. 1.8

Build

./gradlew clean build

CI/CD

Github actions is used for CI/CD.

Releases

Releases to the Maven Central repository are automatically made on each commit on the master branch with the help of the semantic-release.

Contributing

  1. Create an issue and describe your problem/suggestion in it.
  2. Submit a pull request with a reference to the issue that the pull request closes.
  3. I will review your changes and merge them.
  4. A new version with your changes will be released automatically right after merging.

Versioning

We use SemVer for versioning. For the versions available, see the tags.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Acknowledgments

Версии библиотеки

Версия
1.1.1
1.1.0
1.0.6
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1