Skip to content

Commit bdaa6ca

Browse files
committed
Do not depend on the mapstruct-processor module
1 parent fd7fb21 commit bdaa6ca

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ jacocoTestReport {
7777

7878
dependencies {
7979
compile group: 'org.mapstruct', name: 'mapstruct-jdk8', version: '1.1.0.Final'
80-
compile group: 'org.mapstruct', name: 'mapstruct-processor', version: '1.1.0.Final'
8180
testCompile group: 'junit', name: 'junit', version: '4.12'
8281
testCompile group: 'org.assertj', name: 'assertj-core', version: '3.8.0'
8382
}

src/main/java/org/mapstruct/intellij/codeinsight/references/MapstructSourceReference.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import com.intellij.psi.util.PsiUtil;
3434
import org.jetbrains.annotations.NotNull;
3535
import org.jetbrains.annotations.Nullable;
36-
import org.mapstruct.ap.internal.util.Strings;
3736
import org.mapstruct.intellij.util.MapstructUtil;
3837

3938
import static org.mapstruct.intellij.util.MapstructUtil.canDescendIntoType;
@@ -59,10 +58,10 @@ private MapstructSourceReference(PsiLiteral element, MapstructSourceReference pr
5958

6059
@Override
6160
PsiElement resolveInternal(@NotNull String value, @NotNull PsiClass psiClass) {
62-
PsiMethod[] methods = psiClass.findMethodsByName( "get" + Strings.capitalize( value ), true );
61+
PsiMethod[] methods = psiClass.findMethodsByName( "get" + MapstructUtil.capitalize( value ), true );
6362

6463
if ( methods.length == 0 ) {
65-
methods = psiClass.findMethodsByName( "is" + Strings.capitalize( value ), true );
64+
methods = psiClass.findMethodsByName( "is" + MapstructUtil.capitalize( value ), true );
6665
}
6766
return methods.length == 0 ? null : methods[0];
6867
}

src/main/java/org/mapstruct/intellij/codeinsight/references/MapstructTargetReference.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import com.intellij.psi.util.PsiUtil;
3434
import org.jetbrains.annotations.NotNull;
3535
import org.jetbrains.annotations.Nullable;
36-
import org.mapstruct.ap.internal.util.Strings;
3736
import org.mapstruct.intellij.util.MapstructUtil;
3837

3938
import static org.mapstruct.intellij.util.MapstructUtil.canDescendIntoType;
@@ -59,7 +58,7 @@ private MapstructTargetReference(PsiLiteral element, MapstructTargetReference pr
5958

6059
@Override
6160
PsiElement resolveInternal(@NotNull String value, @NotNull PsiClass psiClass) {
62-
PsiMethod[] methods = psiClass.findMethodsByName( "set" + Strings.capitalize( value ), true );
61+
PsiMethod[] methods = psiClass.findMethodsByName( "set" + MapstructUtil.capitalize( value ), true );
6362
return methods.length == 0 ? null : methods[0];
6463
}
6564

src/main/java/org/mapstruct/intellij/util/MapstructUtil.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,4 +204,8 @@ public static boolean canDescendIntoType(PsiType psiType) {
204204

205205
return true;
206206
}
207+
208+
public static String capitalize(String string) {
209+
return string == null ? null : string.substring( 0, 1 ).toUpperCase() + string.substring( 1 );
210+
}
207211
}

0 commit comments

Comments
 (0)