Is there a way to autogenerate java classes from json with jsonschema2pojo where the generics include a primitive byte array? For example i want to generate this private Map<String, byte[]> mappy;
and so far I managed to generate private Map<String, Byte[]> mappy;
by using this:
"properties": {
"mappy": {
"id": "/response/images",
"title": "(images) The images property.",
"javaType" : "java.util.Map<String, Byte[]>",
"type" : "object"
}
}
but I'd rather use the primitive byte array instead of the Byte array. If i try to use byte[]
instead of Byte[]
jsonschema2pojo throws an exception.
OK. I figured a way by using the replacer
plugin in the pom.xml file like this:
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<version>1.5.3</version>
<executions>
<execution>
<id>Convert commons-lang to commons-lang3</id>
<phase>generate-sources</phase>
<goals>
<goal>replace</goal>
</goals>
<configuration>
<includes>
<include>${basedir}/target/java-gen/*.java</include>
</includes>
<replacements>
<replacement>
<token>Byte</token>
<value>byte</value>
</replacement>
</replacements>
</configuration>
</execution>
</executions>
</plugin>