Say I have
class Properties {
private final MediaType mediaType; // javax.ws.rs.core;
public MediaType getMediaType() { return mediaType; }
}
When this is saved into the SQL, it gets saved as
"type": "application",
"subtype": "x-www-form-urlencoded",
"parameters": {
"charset": "utf-8"
},
"wildcardType": false,
"wildcardSubtype": false
How can I make this return toString
version of the MediaType?
You haven't posted your entity code (or you're using Hibernate with xmls) but you do need to create a converter in which you implement conversion methods for both directions:
MediaType
to its toString
json
mapper for that. Here's an example of how to implement converters
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.