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

org.infinispan.marshall.DeltaAwareObjectOutput Maven / Gradle / Ivy

There is a newer version: 9.1.7.Final
Show newest version
package org.infinispan.marshall;

import org.infinispan.atomic.DeltaAware;
import org.infinispan.commons.marshall.DelegatingObjectOutput;

import java.io.IOException;
import java.io.ObjectOutput;

/**
 * An {@link ObjectOutput} delegator that is aware of {@link DeltaAware}.
 * 

* When an instance of {@link DeltaAware} is written, only the {@link DeltaAware#delta()} are written to the underline * {@link ObjectOutput}. * * @author Pedro Ruivo * @since 8.2 */ public class DeltaAwareObjectOutput extends DelegatingObjectOutput { public DeltaAwareObjectOutput(ObjectOutput objectOutput) { super(objectOutput); } @Override public void writeObject(Object obj) throws IOException { if (obj instanceof DeltaAware) { objectOutput.writeObject(((DeltaAware) obj).delta()); } else { objectOutput.writeObject(obj); } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy