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

org.infinispan.interceptors.distribution.VersionedResult Maven / Gradle / Ivy

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

import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.Set;

import org.infinispan.commons.marshall.AdvancedExternalizer;
import org.infinispan.commons.marshall.Ids;
import org.infinispan.commons.util.Util;
import org.infinispan.container.versioning.EntryVersion;

public class VersionedResult {
   public final Object result;
   public final EntryVersion version;

   public VersionedResult(Object result, EntryVersion version) {
      this.result = result;
      this.version = version;
   }

   @Override
   public String toString() {
      return new StringBuilder("VersionedResult{").append(result).append(" (").append(version).append(")}").toString();
   }

   public static class Externalizer implements AdvancedExternalizer {
      @Override
      public Set> getTypeClasses() {
         return Util.asSet(VersionedResult.class);
      }

      @Override
      public Integer getId() {
         return Ids.VERSIONED_RESULT;
      }

      @Override
      public void writeObject(ObjectOutput output, VersionedResult object) throws IOException {
         output.writeObject(object.result);
         output.writeObject(object.version);
      }

      @Override
      public VersionedResult readObject(ObjectInput input) throws IOException, ClassNotFoundException {
         return new VersionedResult(input.readObject(), (EntryVersion) input.readObject());
      }
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy