Skip to content

Commit ce7e676

Browse files
committed
Fix capitalize class name in PresentersBinder
1 parent 6231359 commit ce7e676

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

moxy-compiler/src/main/java/com/omegar/mvp/compiler/Util.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
import javax.lang.model.type.TypeMirror;
4040
import javax.lang.model.type.TypeVariable;
4141
import javax.lang.model.type.WildcardType;
42-
import javax.tools.Diagnostic;
4342

4443
/**
4544
* Utilities for handling types in annotation processors
@@ -209,6 +208,11 @@ public static boolean hasEmptyConstructor(TypeElement element) {
209208
return false;
210209
}
211210

211+
public static String capitalizeString(String string) {
212+
return string == null || string.isEmpty() ? "" : string.length() == 1 ? string.toUpperCase() : Character.toUpperCase(string.charAt(0)) + string.substring(1);
213+
}
214+
215+
212216
public static String decapitalizeString(String string) {
213217
return string == null || string.isEmpty() ? "" : string.length() == 1 ? string.toLowerCase() : Character.toLowerCase(string.charAt(0)) + string.substring(1);
214218
}

moxy-compiler/src/main/java/com/omegar/mvp/compiler/presenterbinder/TargetPresenterField.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.omegar.mvp.compiler.presenterbinder;
22

33
import com.omegar.mvp.MvpProcessor;
4+
import com.omegar.mvp.compiler.Util;
45
import com.omegar.mvp.presenter.PresenterType;
56
import com.squareup.javapoet.ParameterizedTypeName;
67
import com.squareup.javapoet.TypeName;
@@ -48,7 +49,7 @@ TypeName getTypeName() {
4849
}
4950

5051
String getGeneratedClassName() {
51-
return name + MvpProcessor.PRESENTER_BINDER_INNER_SUFFIX;
52+
return Util.capitalizeString(name) + MvpProcessor.PRESENTER_BINDER_INNER_SUFFIX;
5253
}
5354

5455
String getTag() {

0 commit comments

Comments
 (0)