org.aksw.jenax.io.kryo.jena.ExprFunction1Serializer Maven / Gradle / Ivy
package org.aksw.jenax.io.kryo.jena;
import java.util.function.Function;
import org.apache.jena.sparql.expr.Expr;
import org.apache.jena.sparql.expr.ExprFunction1;
import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.Serializer;
import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output;
public class ExprFunction1Serializer extends Serializer {
protected Function ctor;
public ExprFunction1Serializer(Function ctor) {
super();
this.ctor = ctor;
}
@Override
public void write(Kryo kryo, Output output, ExprFunction1 obj) {
kryo.writeClassAndObject(output, obj.getArg());
}
@Override
public T read(Kryo kryo, Input input, Class objClass) {
Expr arg = (Expr)kryo.readClassAndObject(input);
T result = ctor.apply(arg);
return result;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy