io.ebean.text.json.JsonBeanReader Maven / Gradle / Ivy
package io.ebean.text.json;
import com.fasterxml.jackson.core.JsonParser;
import io.ebean.bean.PersistenceContext;
/**
* Provides a JSON reader that can hold a persistence context and load context while reading JSON.
*
* This provides a mechanism such that an object loaded from JSON can have unique instances
* by using a persistence context and also support further lazy loading (via a load context).
*
*/
public interface JsonBeanReader {
/**
* Read the JSON into given bean. Will update existing properties.
*/
T read(T target);
/**
* Read the JSON returning a bean.
*/
default T read() {
return read(null);
}
/**
* Create a new reader taking the context from the existing one but using a new JsonParser.
*/
JsonBeanReader forJson(JsonParser moreJson);
/**
* Add a bean explicitly to the persistence context.
*/
void persistenceContextPut(Object beanId, T currentBean);
/**
* Return the persistence context if one is being used.
*/
PersistenceContext getPersistenceContext();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy