Search in sources :

Example 11 with SerializationContextImpl

use of org.infinispan.protostream.impl.SerializationContextImpl in project kogito-runtimes by kiegroup.

the class ProtostreamProtobufAdapterTypeProvider method buildSerializationContext.

private SerializationContextImpl buildSerializationContext() throws IOException {
    SerializationContextImpl context = new SerializationContextImpl(Configuration.builder().build());
    for (String protoResource : protostreamDescriptors()) {
        try (InputStream is = getInputStream(protoResource)) {
            if (is == null) {
                continue;
            }
            FileDescriptorSource source = new FileDescriptorSource().addProtoFile(getFileName(protoResource), is);
            context.registerProtoFiles(source);
        }
    }
    return context;
}
Also used : SerializationContextImpl(org.infinispan.protostream.impl.SerializationContextImpl) InputStream(java.io.InputStream) FileDescriptorSource(org.infinispan.protostream.FileDescriptorSource)

Aggregations

SerializationContextImpl (org.infinispan.protostream.impl.SerializationContextImpl)11 SerializationContext (org.infinispan.protostream.SerializationContext)5 IOException (java.io.IOException)4 FileDescriptorSource (org.infinispan.protostream.FileDescriptorSource)4 ArrayList (java.util.ArrayList)2 CompilationUnit (com.github.javaparser.ast.CompilationUnit)1 PUBLIC (com.github.javaparser.ast.Modifier.Keyword.PUBLIC)1 NodeList (com.github.javaparser.ast.NodeList)1 ClassOrInterfaceDeclaration (com.github.javaparser.ast.body.ClassOrInterfaceDeclaration)1 MethodDeclaration (com.github.javaparser.ast.body.MethodDeclaration)1 VariableDeclarator (com.github.javaparser.ast.body.VariableDeclarator)1 BinaryExpr (com.github.javaparser.ast.expr.BinaryExpr)1 EQUALS (com.github.javaparser.ast.expr.BinaryExpr.Operator.EQUALS)1 CastExpr (com.github.javaparser.ast.expr.CastExpr)1 ClassExpr (com.github.javaparser.ast.expr.ClassExpr)1 EnclosedExpr (com.github.javaparser.ast.expr.EnclosedExpr)1 Expression (com.github.javaparser.ast.expr.Expression)1 IntegerLiteralExpr (com.github.javaparser.ast.expr.IntegerLiteralExpr)1 MethodCallExpr (com.github.javaparser.ast.expr.MethodCallExpr)1 NameExpr (com.github.javaparser.ast.expr.NameExpr)1