bugfix
This commit is contained in:
parent
3ca89dadb5
commit
6417930897
4 changed files with 11 additions and 7 deletions
|
|
@ -5,12 +5,12 @@
|
|||
<parent>
|
||||
<groupId>nl.sander</groupId>
|
||||
<artifactId>jsonthingy-pom</artifactId>
|
||||
<version>1.0</version>
|
||||
<version>1.2</version>
|
||||
</parent>
|
||||
|
||||
<name>JsonToy-JMH</name>
|
||||
<artifactId>jsonthingy-jmhtests</artifactId>
|
||||
<version>1.1</version>
|
||||
<version>1.2</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
|
|
@ -19,7 +19,6 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@
|
|||
<parent>
|
||||
<groupId>nl.sander</groupId>
|
||||
<artifactId>jsonthingy-pom</artifactId>
|
||||
<version>1.0</version>
|
||||
<version>1.2</version>
|
||||
</parent>
|
||||
|
||||
<name>JsonToy</name>
|
||||
<artifactId>jsonthingy</artifactId>
|
||||
<version>1.1</version>
|
||||
<version>1.2</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ public class MapperFactory extends ClassVisitor {
|
|||
}
|
||||
|
||||
getterInsnList.add(new VarInsnNode(ALOAD, 1));
|
||||
getterInsnList.add(new LdcInsnNode("\"" + getterMethodName.substring(startIndex).toLowerCase() + "\":"));
|
||||
getterInsnList.add(new LdcInsnNode("\"" + correctName(getterMethodName, startIndex) + "\":"));
|
||||
getterInsnList.add(new MethodInsnNode(INVOKEVIRTUAL, STRINGBUILDER, APPEND, APPEND_SIGNATURE));
|
||||
getterInsnList.add(new InsnNode(POP));
|
||||
getterInsnList.add(new VarInsnNode(ALOAD, 1));
|
||||
|
|
@ -101,6 +101,11 @@ public class MapperFactory extends ClassVisitor {
|
|||
getterInsnList.add(new MethodInsnNode(INVOKESTATIC, MAPPER, "json", "(Ljava/lang/StringBuilder;" + genericReturnType(returnType) + ")V"));
|
||||
}
|
||||
|
||||
private String correctName(String getterMethodName, int startIndex) {
|
||||
String tmp = getterMethodName.substring(startIndex);
|
||||
return tmp.substring(0, 1).toLowerCase() + tmp.substring(1);
|
||||
}
|
||||
|
||||
private static String genericReturnType(String returnType) {
|
||||
char firstChar = returnType.charAt(0);
|
||||
if (firstChar == 'L' || firstChar == '[') {
|
||||
|
|
|
|||
2
pom.xml
2
pom.xml
|
|
@ -5,7 +5,7 @@
|
|||
<name>JsonToy</name>
|
||||
<groupId>nl.sander</groupId>
|
||||
<artifactId>jsonthingy-pom</artifactId>
|
||||
<version>1.1</version>
|
||||
<version>1.2</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue