JsonDeserializers.java
package org.genesys.server.service.worker;
import java.io.IOException;
import org.genesys.server.model.genesys.AccessionRemark;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
public class JsonDeserializers {
/**
* Deserialize "FIELD:text"
*/
public static class AccessionRemarkDeserializer extends StdDeserializer<AccessionRemark> {
private static final long serialVersionUID = 1L;
protected AccessionRemarkDeserializer(Class<?> vc) {
super(vc);
}
@Override
public AccessionRemark deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
String str = p.getText();
if (str == null || str.length() == 0) {
return null;
}
AccessionRemark ar = new AccessionRemark(str);
return ar;
}
}
}