forked from mapstruct/mapstruct-idea
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImmutablesMapstructUtil.java
More file actions
31 lines (26 loc) · 942 Bytes
/
ImmutablesMapstructUtil.java
File metadata and controls
31 lines (26 loc) · 942 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
* Copyright MapStruct Authors.
*
* Licensed under the Apache License version 2.0, available at https://www.apache.org/licenses/LICENSE-2.0
*/
package org.mapstruct.intellij.util;
import com.intellij.psi.PsiMethod;
import com.intellij.psi.PsiType;
import org.jetbrains.annotations.NotNull;
/**
* Mapstruct util for Immutables.
* The generated Immutables also have a from that works as a copy. Our default strategy considers this method
* as a setter with a name {@code from}. Therefore, we are ignoring it.
*/
public class ImmutablesMapstructUtil extends MapstructUtil {
static final MapstructUtil INSTANCE = new ImmutablesMapstructUtil();
/**
* Hide constructor.
*/
private ImmutablesMapstructUtil() {
}
@Override
public boolean isFluentSetter(@NotNull PsiMethod method, PsiType psiType) {
return super.isFluentSetter( method, psiType ) && !method.getName().equals( "from" );
}
}