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