You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@JsonObject
public class JsonRpcRequests {
@JsonField
Map<Class, ApiRequest> requests;
}
The following mapper code is generated
public final class JsonRpcRequests$$JsonObjectMapper extends JsonMapper<JsonRpcRequests> {
private static final JsonMapper<ApiRequest> COM_TREVJONEZ_RETRORX_BUSY_API_APIREQUEST__JSONOBJECTMAPPER = LoganSquare.mapperFor(ApiRequest.class);
private static TypeConverter<Class> java_lang_Class_type_converter;
@Override
public JsonRpcRequests parse(JsonParser jsonParser) throws IOException {
JsonRpcRequests instance = new JsonRpcRequests();
if (jsonParser.getCurrentToken() == null) {
jsonParser.nextToken();
}
if (jsonParser.getCurrentToken() != JsonToken.START_OBJECT) {
jsonParser.skipChildren();
return null;
}
while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
String fieldName = jsonParser.getCurrentName();
jsonParser.nextToken();
parseField(instance, fieldName, jsonParser);
jsonParser.skipChildren();
}
return instance;
}
@Override
public void parseField(JsonRpcRequests instance, String fieldName, JsonParser jsonParser) throws IOException {
if ("requests".equals(fieldName)) {
if (jsonParser.getCurrentToken() == JsonToken.START_OBJECT) {
HashMap<String, ApiRequest> map1 = new HashMap<String, ApiRequest>();
while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
String key1 = jsonParser.getText();
jsonParser.nextToken();
if (jsonParser.getCurrentToken() == JsonToken.VALUE_NULL) {
map1.put(key1, null);
} else {
map1.put(key1, COM_TREVJONEZ_RETRORX_BUSY_API_APIREQUEST__JSONOBJECTMAPPER.parse(jsonParser));
}
}
instance.requests = map1;
} else {
instance.requests = null;
}
}
}
@Override
public void serialize(JsonRpcRequests object, JsonGenerator jsonGenerator, boolean writeStartAndEnd) throws IOException {
if (writeStartAndEnd) {
jsonGenerator.writeStartObject();
}
final Map<String, ApiRequest> lslocalrequests = object.requests;
if (lslocalrequests != null) {
jsonGenerator.writeFieldName("requests");
jsonGenerator.writeStartObject();
for (Map.Entry<String, ApiRequest> entry1 : lslocalrequests.entrySet()) {
jsonGenerator.writeFieldName(entry1.getKey().toString());
if (entry1.getValue() != null) {
COM_TREVJONEZ_RETRORX_BUSY_API_APIREQUEST__JSONOBJECTMAPPER.serialize(entry1.getValue(), jsonGenerator, true);
}
}
jsonGenerator.writeEndObject();
}
if (writeStartAndEnd) {
jsonGenerator.writeEndObject();
}
}
private static final TypeConverter<Class> getjava_lang_Class_type_converter() {
if (java_lang_Class_type_converter == null) {
java_lang_Class_type_converter = LoganSquare.typeConverterFor(Class.class);
}
return java_lang_Class_type_converter;
}
}
The processor generates the serializing and parsing code with the assumption that the type will be of String.class ( Here, Here & Here )
It seems as though any provided or default TypeConverter<T> should be dispatched for the purpose of serialization here, as apposed to the current .toString() approach.
Based on the unused methods in the generated code and the logic here, it would seem like this was your eventual intent.
I plan to work on a pull request for this in the morning however if my understanding of the issue and speculation of your intent are wrong please let me know at your earliest convenience.
The text was updated successfully, but these errors were encountered:
It would seem that all of this is far less flexible than I would have hoped.
I am going to play with just simply doing a custom type converter and see where I can get in that direction.
Given the following simple class
The following mapper code is generated
The processor generates the serializing and parsing code with the assumption that the type will be of
String.class
( Here, Here & Here )It seems as though any provided or default
TypeConverter<T>
should be dispatched for the purpose of serialization here, as apposed to the current.toString()
approach.Based on the unused methods in the generated code and the logic here, it would seem like this was your eventual intent.
I plan to work on a pull request for this in the morning however if my understanding of the issue and speculation of your intent are wrong please let me know at your earliest convenience.
The text was updated successfully, but these errors were encountered: