mirror of
https://gitee.com/easii/mapstruct-plus.git
synced 2025-12-08 10:08:47 +08:00
兼容内部类
This commit is contained in:
parent
9e7716d799
commit
1c8c6fd79c
@ -18,7 +18,7 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<mapstruct.version>1.5.1.Final</mapstruct.version>
|
||||
<mapstruct-plus.version>1.3.5</mapstruct-plus.version>
|
||||
<mapstruct-plus.version>1.3.6-SNAPSHOT</mapstruct-plus.version>
|
||||
<lombok.version>1.18.22</lombok.version>
|
||||
</properties>
|
||||
|
||||
|
||||
@ -17,4 +17,9 @@ public class Car {
|
||||
@AutoMapping(target = "wheels", ignore = true)
|
||||
private Wheels wheels;
|
||||
|
||||
@Data
|
||||
public static class InnerClass {
|
||||
private String f;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,12 @@
|
||||
package io.github.linpeilie.model;
|
||||
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@AutoMapper(target = Car.InnerClass.class)
|
||||
public class InnerClassTarget {
|
||||
|
||||
private String f;
|
||||
|
||||
}
|
||||
@ -90,7 +90,7 @@ public class AutoMapperGenerator {
|
||||
|
||||
private boolean classIsImmutable(ProcessingEnvironment processingEnv, ClassName className) {
|
||||
final TypeElement targetElement = processingEnv.getElementUtils()
|
||||
.getTypeElement(className.packageName() + "." + className.simpleName());
|
||||
.getTypeElement(className.reflectionName().replaceAll("\\$", "."));
|
||||
final List<? extends AnnotationMirror> annotationMirrors = targetElement.getAnnotationMirrors();
|
||||
for (AnnotationMirror annotationMirror : annotationMirrors) {
|
||||
if (annotationMirror.getAnnotationType().asElement().getSimpleName().contentEquals("Immutable")) {
|
||||
|
||||
2
pom.xml
2
pom.xml
@ -17,7 +17,7 @@
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<mapstruct-plus.version>1.3.5</mapstruct-plus.version>
|
||||
<mapstruct-plus.version>1.3.6-SNAPSHOT</mapstruct-plus.version>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user