All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.avaje.ebeaninternal.server.text.json.DJsonBeanReader Maven / Gradle / Ivy

package com.avaje.ebeaninternal.server.text.json;

import com.avaje.ebean.PersistenceIOException;
import com.avaje.ebean.bean.PersistenceContext;
import com.avaje.ebean.text.json.JsonBeanReader;
import com.avaje.ebeaninternal.server.deploy.BeanDescriptor;
import com.fasterxml.jackson.core.JsonParser;

import java.io.IOException;

/**
 * A 'context' for reading entity beans from JSON.
 * 

* This is used such that a load context and persistence context can be used to span multiple marshalling requests. *

*/ public class DJsonBeanReader implements JsonBeanReader { private final BeanDescriptor desc; private final ReadJson readJson; public DJsonBeanReader(BeanDescriptor desc, ReadJson readJson) { this.desc = desc; this.readJson = readJson; } @Override public void persistenceContextPut(Object beanId, T currentBean) { readJson.persistenceContextPut(beanId, currentBean); } @Override public PersistenceContext getPersistenceContext() { return readJson.getPersistenceContext(); } @Override public T read() { try { return desc.jsonRead(readJson, null); } catch (IOException e) { throw new PersistenceIOException(e); } } @Override public JsonBeanReader forJson(JsonParser moreJson, boolean resetContext) { return new DJsonBeanReader(desc, readJson.forJson(moreJson, resetContext)); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy