An IntelliJ IDEA plugin for working with MapStruct
MapStruct is a Java annotation processor for the generation of type-safe and performant mappers for Java bean classes.
To learn more about MapStruct have a look at the mapstruct repository or the website
- Code completions
- Completion of
targetandsourceproperties in@Mappingannotation (nested properties also work) - Completion of
targetandsourceproperties in@ValueMappingannotation - Completion of
componentModelin@Mapperand@MapperConfigannotations - Completion of
qualifiedByNamein@Mappingannotation
- Completion of
- Go To Declaration for properties in
targetandsourceto setters / getters - Go To Declaration for
Mapping#qualifiedByName - Find usages of properties in
targetandsourceand find usages of setters / getters in@Mappingannotations - Highlighting properties in
targetandsource - Errors and Quick fixes:
@Mapperor@MapperConfigannotation missing- Unmapped target properties with quick fixes: Add unmapped target property and Ignore unmapped target property.
Uses
unmappedTargetPolicyto determine the severity that should be used - No
sourcedefined in@Mappingannotation - More than one
sourcein@Mappingannotation defined with quick fixes: Removesource. Removeconstant. Removeexpression. UseconstantasdefaultValue. UseexpressionasdefaultExpression. - More than one default source in
@Mappingannotation defined with quick fixes: RemovedefaultValue. RemovedefaultExpression. targetmapped more than once by@Mappingannotations with quick fixes: Remove annotation and change target property.*used as a source in@Mappingannotation with quick fixes: Replace*with method parameter name.- Unknown reference inspection for
sourceandtargetin@Mappingand@ValueMappingannotation. - Unknown reference inspection for
qualifiedByNamein@Mappingannotation
The MapStruct plugin requires Java 11 or later
Since the project has been migrated to the Gradle and [Gradle IntelliJ plugin][gradle-intellij-plugin], the build process is much simpler. The only thing to build the plugin is to run:
./gradlew build
All required dependencies like Grammar-Kit, JFlex are downloaded in the background and triggered properly during the build process. You can also test the plugin easily with running:
./gradlew runIde
All of the gradle tasks can be connected to the IntelliJ debugger, so the development process is very easy.
The MapStruct plugin is licensed under the Apache License, Version 2.0 (the "License"); you may not use it except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0.