diff --git a/jmh/pom.xml b/jmh/pom.xml index 139f0b0..dce6aa5 100644 --- a/jmh/pom.xml +++ b/jmh/pom.xml @@ -5,12 +5,12 @@ nl.sander jsonthingy-pom - 1.0 + 1.2 JsonToy-JMH jsonthingy-jmhtests - 1.1 + 1.2 jar @@ -19,7 +19,6 @@ UTF-8 - ${project.groupId} diff --git a/lib/pom.xml b/lib/pom.xml index c8edd04..b61f595 100644 --- a/lib/pom.xml +++ b/lib/pom.xml @@ -5,12 +5,12 @@ nl.sander jsonthingy-pom - 1.0 + 1.2 JsonToy jsonthingy - 1.1 + 1.2 jar diff --git a/lib/src/main/java/nl/sanderhautvast/json/ser/MapperFactory.java b/lib/src/main/java/nl/sanderhautvast/json/ser/MapperFactory.java index f14655a..0b1ea9f 100644 --- a/lib/src/main/java/nl/sanderhautvast/json/ser/MapperFactory.java +++ b/lib/src/main/java/nl/sanderhautvast/json/ser/MapperFactory.java @@ -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 == '[') { diff --git a/pom.xml b/pom.xml index fad778f..73ef914 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ JsonToy nl.sander jsonthingy-pom - 1.1 + 1.2 pom