Java.libraries.rest-assured.GsonObjectMapper.mustache Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of stackgen Show documentation
Show all versions of stackgen Show documentation
Starter StackGen CORE Service Generator
{{>licenseInfo}}
package {{invokerPackage}};
import io.restassured.mapper.ObjectMapper;
import io.restassured.mapper.ObjectMapperDeserializationContext;
import io.restassured.mapper.ObjectMapperSerializationContext;
public class GsonObjectMapper implements ObjectMapper {
private JSON json;
private GsonObjectMapper() {
this.json = new JSON();
}
public static GsonObjectMapper gson() {
return new GsonObjectMapper();
}
@Override
public Object deserialize(ObjectMapperDeserializationContext context) {
return json.deserialize(context.getDataToDeserialize().asString(), context.getType());
}
@Override
public Object serialize(ObjectMapperSerializationContext context) {
return json.serialize(context.getObjectToSerialize());
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy