Search in sources :

Example 1 with SerializationContextImpl

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

the class ProtoIndexParserTest method testConfigureBuilderWithInvalidFile.

@Test
void testConfigureBuilderWithInvalidFile() {
    SerializationContext ctx = new SerializationContextImpl(configureBuilder().build());
    FileDescriptorSource invalidFileDescriptorSource = FileDescriptorSource.fromString("invalid", "invalid");
    try {
        ctx.registerProtoFiles(invalidFileDescriptorSource);
        fail("Failed to process invalid proto file");
    } catch (DescriptorParserException ex) {
    // Successfully throw exception
    }
}
Also used : SerializationContext(org.infinispan.protostream.SerializationContext) DescriptorParserException(org.infinispan.protostream.DescriptorParserException) SerializationContextImpl(org.infinispan.protostream.impl.SerializationContextImpl) FileDescriptorSource(org.infinispan.protostream.FileDescriptorSource) Test(org.junit.jupiter.api.Test)

Example 2 with SerializationContextImpl

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

the class TestUtils method getTestFileDescriptor.

static FileDescriptor getTestFileDescriptor() {
    String content = getTestFileContent();
    SerializationContext ctx = new SerializationContextImpl(Configuration.builder().build());
    ctx.registerProtoFiles(FileDescriptorSource.fromString(DOMAIN_MODEL_PROTO_NAME, content));
    return ctx.getFileDescriptors().get(DOMAIN_MODEL_PROTO_NAME);
}
Also used : SerializationContext(org.infinispan.protostream.SerializationContext) SerializationContextImpl(org.infinispan.protostream.impl.SerializationContextImpl)

Example 3 with SerializationContextImpl

use of org.infinispan.protostream.impl.SerializationContextImpl in project protostream by infinispan.

the class WrappedMessage method readMessage.

private static <T> T readMessage(ImmutableSerializationContext ctx, TagReader in, boolean nulls) throws IOException {
    String typeName = null;
    Integer typeId = null;
    int enumValue = -1;
    byte[] messageBytes = null;
    Object value = null;
    int fieldCount = 0;
    int expectedFieldCount = 1;
    int tag;
    out: while ((tag = in.readTag()) != 0) {
        fieldCount++;
        switch(tag) {
            case WRAPPED_CONTAINER_SIZE << WireType.TAG_TYPE_NUM_BITS | WireType.WIRETYPE_VARINT:
            case WRAPPED_CONTAINER_TYPE_ID << WireType.TAG_TYPE_NUM_BITS | WireType.WIRETYPE_VARINT:
            case WRAPPED_CONTAINER_TYPE_NAME << WireType.TAG_TYPE_NUM_BITS | WireType.WIRETYPE_LENGTH_DELIMITED:
            case WRAPPED_CONTAINER_MESSAGE << WireType.TAG_TYPE_NUM_BITS | WireType.WIRETYPE_LENGTH_DELIMITED:
                {
                    expectedFieldCount = 1;
                    value = readContainer(ctx, in, tag);
                    break out;
                }
            case WRAPPED_EMPTY << WireType.TAG_TYPE_NUM_BITS | WireType.WIRETYPE_VARINT:
                {
                    if (!nulls) {
                        throw new IllegalStateException("Encountered a null message but nulls are not accepted");
                    }
                    expectedFieldCount = 1;
                    // We ignore the actual boolean value! Will be returning null anyway.
                    in.readBool();
                    break out;
                }
            case WRAPPED_TYPE_NAME << WireType.TAG_TYPE_NUM_BITS | WireType.WIRETYPE_LENGTH_DELIMITED:
                {
                    expectedFieldCount = 2;
                    typeName = in.readString();
                    break;
                }
            case WRAPPED_TYPE_ID << WireType.TAG_TYPE_NUM_BITS | WireType.WIRETYPE_VARINT:
                {
                    expectedFieldCount = 2;
                    typeId = mapTypeIdIn(in.readInt32(), ctx);
                    break;
                }
            case WRAPPED_ENUM << WireType.TAG_TYPE_NUM_BITS | WireType.WIRETYPE_VARINT:
                {
                    expectedFieldCount = 2;
                    enumValue = in.readEnum();
                    break;
                }
            case WRAPPED_MESSAGE << WireType.TAG_TYPE_NUM_BITS | WireType.WIRETYPE_LENGTH_DELIMITED:
                {
                    expectedFieldCount = 2;
                    messageBytes = in.readByteArray();
                    break;
                }
            case WRAPPED_STRING << WireType.TAG_TYPE_NUM_BITS | WireType.WIRETYPE_LENGTH_DELIMITED:
                {
                    expectedFieldCount = 1;
                    value = in.readString();
                    break out;
                }
            case WRAPPED_CHAR << WireType.TAG_TYPE_NUM_BITS | WireType.WIRETYPE_VARINT:
                {
                    expectedFieldCount = 1;
                    value = (char) in.readInt32();
                    break out;
                }
            case WRAPPED_SHORT << WireType.TAG_TYPE_NUM_BITS | WireType.WIRETYPE_VARINT:
                {
                    expectedFieldCount = 1;
                    value = (short) in.readInt32();
                    break out;
                }
            case WRAPPED_BYTE << WireType.TAG_TYPE_NUM_BITS | WireType.WIRETYPE_VARINT:
                {
                    expectedFieldCount = 1;
                    value = (byte) in.readInt32();
                    break out;
                }
            case WRAPPED_DATE_MILLIS << WireType.TAG_TYPE_NUM_BITS | WireType.WIRETYPE_VARINT:
                {
                    expectedFieldCount = 1;
                    value = new Date(in.readInt64());
                    break out;
                }
            case WRAPPED_INSTANT_SECONDS << WireType.TAG_TYPE_NUM_BITS | WireType.WIRETYPE_VARINT:
                {
                    expectedFieldCount = 2;
                    long seconds = in.readInt64();
                    value = value == null ? Instant.ofEpochSecond(seconds, 0) : Instant.ofEpochSecond(seconds, ((Instant) value).getNano());
                    break;
                }
            case WRAPPED_INSTANT_NANOS << WireType.TAG_TYPE_NUM_BITS | WireType.WIRETYPE_VARINT:
                {
                    expectedFieldCount = 2;
                    int nanos = in.readInt32();
                    value = value == null ? Instant.ofEpochSecond(0, nanos) : Instant.ofEpochSecond(((Instant) value).getEpochSecond(), nanos);
                    break;
                }
            case WRAPPED_BYTES << WireType.TAG_TYPE_NUM_BITS | WireType.WIRETYPE_LENGTH_DELIMITED:
                {
                    expectedFieldCount = 1;
                    value = in.readByteArray();
                    break out;
                }
            case WRAPPED_BOOL << WireType.TAG_TYPE_NUM_BITS | WireType.WIRETYPE_VARINT:
                {
                    expectedFieldCount = 1;
                    value = in.readBool();
                    break out;
                }
            case WRAPPED_DOUBLE << WireType.TAG_TYPE_NUM_BITS | WireType.WIRETYPE_FIXED64:
                {
                    expectedFieldCount = 1;
                    value = in.readDouble();
                    break out;
                }
            case WRAPPED_FLOAT << WireType.TAG_TYPE_NUM_BITS | WireType.WIRETYPE_FIXED32:
                {
                    expectedFieldCount = 1;
                    value = in.readFloat();
                    break out;
                }
            case WRAPPED_FIXED32 << WireType.TAG_TYPE_NUM_BITS | WireType.WIRETYPE_FIXED32:
                {
                    expectedFieldCount = 1;
                    value = in.readFixed32();
                    break out;
                }
            case WRAPPED_SFIXED32 << WireType.TAG_TYPE_NUM_BITS | WireType.WIRETYPE_FIXED32:
                {
                    expectedFieldCount = 1;
                    value = in.readSFixed32();
                    break out;
                }
            case WRAPPED_FIXED64 << WireType.TAG_TYPE_NUM_BITS | WireType.WIRETYPE_FIXED64:
                {
                    expectedFieldCount = 1;
                    value = in.readFixed64();
                    break out;
                }
            case WRAPPED_SFIXED64 << WireType.TAG_TYPE_NUM_BITS | WireType.WIRETYPE_FIXED64:
                {
                    expectedFieldCount = 1;
                    value = in.readSFixed64();
                    break out;
                }
            case WRAPPED_INT64 << WireType.TAG_TYPE_NUM_BITS | WireType.WIRETYPE_VARINT:
                {
                    expectedFieldCount = 1;
                    value = in.readInt64();
                    break out;
                }
            case WRAPPED_UINT64 << WireType.TAG_TYPE_NUM_BITS | WireType.WIRETYPE_VARINT:
                {
                    expectedFieldCount = 1;
                    value = in.readUInt64();
                    break out;
                }
            case WRAPPED_SINT64 << WireType.TAG_TYPE_NUM_BITS | WireType.WIRETYPE_VARINT:
                {
                    expectedFieldCount = 1;
                    value = in.readSInt64();
                    break out;
                }
            case WRAPPED_INT32 << WireType.TAG_TYPE_NUM_BITS | WireType.WIRETYPE_VARINT:
                {
                    expectedFieldCount = 1;
                    value = in.readInt32();
                    break out;
                }
            case WRAPPED_UINT32 << WireType.TAG_TYPE_NUM_BITS | WireType.WIRETYPE_VARINT:
                {
                    expectedFieldCount = 1;
                    value = in.readUInt32();
                    break out;
                }
            case WRAPPED_SINT32 << WireType.TAG_TYPE_NUM_BITS | WireType.WIRETYPE_VARINT:
                {
                    expectedFieldCount = 1;
                    value = in.readSInt32();
                    break out;
                }
            default:
                throw new IllegalStateException("Unexpected tag : " + tag + " (Field number : " + WireType.getTagFieldNumber(tag) + ", Wire type : " + WireType.getTagWireType(tag) + ")");
        }
    }
    if (value == null && typeName == null && typeId == null && messageBytes == null) {
        return null;
    }
    if (value != null) {
        if (fieldCount != expectedFieldCount) {
            throw new IOException("Invalid WrappedMessage encoding.");
        }
        return (T) value;
    }
    if (typeName == null && typeId == null || typeName != null && typeId != null || fieldCount != 2) {
        throw new IOException("Invalid WrappedMessage encoding.");
    }
    if (typeId != null) {
        typeName = ctx.getDescriptorByTypeId(typeId).getFullName();
    }
    BaseMarshallerDelegate marshallerDelegate = ((SerializationContextImpl) ctx).getMarshallerDelegate(typeName);
    if (messageBytes != null) {
        // it's a Message type
        TagReaderImpl nestedInput = TagReaderImpl.newInstance(ctx, messageBytes);
        return (T) marshallerDelegate.unmarshall(nestedInput, null);
    } else {
        // it's an Enum
        EnumMarshaller marshaller = (EnumMarshaller) marshallerDelegate.getMarshaller();
        T e = (T) marshaller.decode(enumValue);
        if (e == null) {
            // Unknown enum value cause by schema evolution. We cannot handle data loss here so we throw!
            throw new IOException("Unknown enum value " + enumValue + " for Protobuf enum type " + typeName);
        }
        return e;
    }
}
Also used : TagReaderImpl(org.infinispan.protostream.impl.TagReaderImpl) IOException(java.io.IOException) Date(java.util.Date) SerializationContextImpl(org.infinispan.protostream.impl.SerializationContextImpl) BaseMarshallerDelegate(org.infinispan.protostream.impl.BaseMarshallerDelegate)

Example 4 with SerializationContextImpl

use of org.infinispan.protostream.impl.SerializationContextImpl in project protostream by infinispan.

the class ProtobufUtil method newSerializationContext.

public static SerializationContext newSerializationContext(Configuration configuration) {
    SerializationContextImpl serializationContext = new SerializationContextImpl(configuration);
    try {
        // always register message-wrapping.proto
        serializationContext.registerProtoFiles(FileDescriptorSource.fromResources(WrappedMessage.PROTO_FILE));
    } catch (IOException | DescriptorParserException e) {
        throw new RuntimeException("Failed to initialize serialization context", e);
    }
    serializationContext.registerMarshaller(WrappedMessage.MARSHALLER);
    return serializationContext;
}
Also used : SerializationContextImpl(org.infinispan.protostream.impl.SerializationContextImpl) IOException(java.io.IOException)

Example 5 with SerializationContextImpl

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

the class AbstractMarshallerGenerator method generate.

public List<CompilationUnit> generate(FileDescriptorSource proto) throws IOException {
    List<CompilationUnit> units = new ArrayList<>();
    TemplatedGenerator generator = TemplatedGenerator.builder().withFallbackContext(JavaKogitoBuildContext.CONTEXT_NAME).withTemplateBasePath(TEMPLATE_PERSISTENCE_FOLDER).build(context, "MessageMarshaller");
    Predicate<String> typeExclusions = ExclusionTypeUtils.createTypeExclusions();
    // filter types that don't require to create a marshaller
    Predicate<Descriptor> packagePredicate = (msg) -> !msg.getFileDescriptor().getPackage().equals("kogito");
    Predicate<Descriptor> jacksonPredicate = (msg) -> !typeExclusions.test(packageFromOption(msg.getFileDescriptor(), msg) + "." + msg.getName());
    Predicate<Descriptor> predicate = packagePredicate.and(jacksonPredicate);
    CompilationUnit parsedClazzFile = generator.compilationUnitOrThrow();
    SerializationContext serializationContext = new SerializationContextImpl(Configuration.builder().build());
    FileDescriptorSource kogitoTypesDescriptor = new FileDescriptorSource().addProtoFile("kogito-types.proto", context.getClassLoader().getResourceAsStream("META-INF/kogito-types.proto"));
    serializationContext.registerProtoFiles(kogitoTypesDescriptor);
    serializationContext.registerProtoFiles(proto);
    Map<String, FileDescriptor> descriptors = serializationContext.getFileDescriptors();
    for (Entry<String, FileDescriptor> entry : descriptors.entrySet()) {
        FileDescriptor d = entry.getValue();
        List<Descriptor> messages = d.getMessageTypes().stream().filter(predicate).collect(Collectors.toList());
        for (Descriptor msg : messages) {
            CompilationUnit clazzFile = parsedClazzFile.clone();
            units.add(clazzFile);
            String javaType = packageFromOption(d, msg) + "." + msg.getName();
            clazzFile.setPackageDeclaration(d.getPackage());
            ClassOrInterfaceDeclaration clazz = clazzFile.findFirst(ClassOrInterfaceDeclaration.class, sl -> true).orElseThrow(() -> new InvalidTemplateException(generator, "No class found"));
            clazz.setName(msg.getName() + "MessageMarshaller");
            clazz.getImplementedTypes(0).setTypeArguments(NodeList.nodeList(new ClassOrInterfaceType(null, javaType)));
            MethodDeclaration getJavaClassMethod = clazz.findFirst(MethodDeclaration.class, md -> md.getNameAsString().equals("getJavaClass")).orElseThrow(() -> new InvalidTemplateException(generator, "No getJavaClass method found"));
            getJavaClassMethod.setType(new ClassOrInterfaceType(null, new SimpleName(Class.class.getName()), NodeList.nodeList(new ClassOrInterfaceType(null, javaType))));
            BlockStmt getJavaClassMethodBody = new BlockStmt();
            getJavaClassMethodBody.addStatement(new ReturnStmt(new NameExpr(javaType + ".class")));
            getJavaClassMethod.setBody(getJavaClassMethodBody);
            MethodDeclaration getTypeNameMethod = clazz.findFirst(MethodDeclaration.class, md -> md.getNameAsString().equals("getTypeName")).orElseThrow(() -> new InvalidTemplateException(generator, "No getTypeName method found"));
            BlockStmt getTypeNameMethodBody = new BlockStmt();
            getTypeNameMethodBody.addStatement(new ReturnStmt(new StringLiteralExpr(msg.getFullName())));
            getTypeNameMethod.setBody(getTypeNameMethodBody);
            MethodDeclaration readFromMethod = clazz.findFirst(MethodDeclaration.class, md -> md.getNameAsString().equals("readFrom")).orElseThrow(() -> new InvalidTemplateException(generator, "No readFrom method found"));
            readFromMethod.setType(javaType);
            readFromMethod.setBody(new BlockStmt());
            MethodDeclaration writeToMethod = clazz.findFirst(MethodDeclaration.class, md -> md.getNameAsString().equals("writeTo")).orElseThrow(() -> new InvalidTemplateException(generator, "No writeTo method found"));
            writeToMethod.getParameter(1).setType(javaType);
            writeToMethod.setBody(new BlockStmt());
            ClassOrInterfaceType classType = new ClassOrInterfaceType(null, javaType);
            // read method
            VariableDeclarationExpr instance = new VariableDeclarationExpr(new VariableDeclarator(classType, "value", new ObjectCreationExpr(null, classType, NodeList.nodeList())));
            readFromMethod.getBody().ifPresent(b -> b.addStatement(instance));
            for (FieldDescriptor field : msg.getFields()) {
                String protoStreamMethodType = protoStreamMethodType(field.getTypeName());
                Expression write = null;
                Expression read = null;
                if (protoStreamMethodType != null && !field.isRepeated()) {
                    // has a mapped type
                    read = new MethodCallExpr(new NameExpr("reader"), "read" + protoStreamMethodType).addArgument(new StringLiteralExpr(field.getName()));
                    String accessor = protoStreamMethodType.equals("Boolean") ? "is" : "get";
                    write = new MethodCallExpr(new NameExpr("writer"), "write" + protoStreamMethodType).addArgument(new StringLiteralExpr(field.getName())).addArgument(new MethodCallExpr(new NameExpr("t"), accessor + StringUtils.ucFirst(field.getName())));
                } else {
                    // custom types
                    String customTypeName = javaTypeForMessage(d, field.getTypeName(), serializationContext);
                    if (field.isRepeated()) {
                        if (null == customTypeName || customTypeName.isEmpty()) {
                            customTypeName = primaryTypeClassName(field.getTypeName());
                        }
                        String writeMethod;
                        if (isArray(javaType, field)) {
                            writeMethod = "writeArray";
                            read = new MethodCallExpr(new NameExpr("reader"), "readArray").addArgument(new StringLiteralExpr(field.getName())).addArgument(new NameExpr(customTypeName + ".class"));
                        } else {
                            writeMethod = "writeCollection";
                            read = new MethodCallExpr(new NameExpr("reader"), "readCollection").addArgument(new StringLiteralExpr(field.getName())).addArgument(new ObjectCreationExpr(null, new ClassOrInterfaceType(null, ArrayList.class.getCanonicalName()), NodeList.nodeList())).addArgument(new NameExpr(customTypeName + ".class"));
                        }
                        write = new MethodCallExpr(new NameExpr("writer"), writeMethod).addArgument(new StringLiteralExpr(field.getName())).addArgument(new MethodCallExpr(new NameExpr("t"), "get" + StringUtils.ucFirst(field.getName()))).addArgument(new NameExpr(customTypeName + ".class"));
                    } else {
                        read = new MethodCallExpr(new NameExpr("reader"), "readObject").addArgument(new StringLiteralExpr(field.getName())).addArgument(new NameExpr(customTypeName + ".class"));
                        write = new MethodCallExpr(new NameExpr("writer"), "writeObject").addArgument(new StringLiteralExpr(field.getName())).addArgument(new MethodCallExpr(new NameExpr("t"), "get" + StringUtils.ucFirst(field.getName()))).addArgument(new NameExpr(customTypeName + ".class"));
                    }
                    if (customTypeName.equals(Serializable.class.getName())) {
                        String fieldClazz = (String) field.getOptionByName(KOGITO_JAVA_CLASS_OPTION);
                        if (fieldClazz == null) {
                            throw new IllegalArgumentException(format("Serializable proto field '%s' is missing value for option %s", field.getName(), KOGITO_JAVA_CLASS_OPTION));
                        } else {
                            read = new CastExpr().setExpression(new EnclosedExpr(read)).setType(fieldClazz);
                        }
                    }
                }
                MethodCallExpr setter = new MethodCallExpr(new NameExpr("value"), "set" + StringUtils.ucFirst(field.getName())).addArgument(read);
                readFromMethod.getBody().ifPresent(b -> b.addStatement(setter));
                // write method
                writeToMethod.getBody().orElseThrow(() -> new NoSuchElementException("A method declaration doesn't contain a body!")).addStatement(write);
            }
            readFromMethod.getBody().ifPresent(b -> b.addStatement(new ReturnStmt(new NameExpr("value"))));
            clazz.getMembers().sort(new BodyDeclarationComparator());
        }
        for (EnumDescriptor msg : d.getEnumTypes()) {
            CompilationUnit compilationUnit = new CompilationUnit();
            units.add(compilationUnit);
            String javaType = packageFromOption(d, msg) + "." + msg.getName();
            ClassOrInterfaceDeclaration classDeclaration = compilationUnit.setPackageDeclaration(d.getPackage()).addClass(msg.getName() + "EnumMarshaller").setPublic(true);
            classDeclaration.addImplementedType(EnumMarshaller.class).getImplementedTypes(0).setTypeArguments(NodeList.nodeList(new ClassOrInterfaceType(null, javaType)));
            classDeclaration.addMethod("getTypeName", PUBLIC).setType(String.class).setBody(new BlockStmt().addStatement(new ReturnStmt(new StringLiteralExpr(msg.getFullName()))));
            classDeclaration.addMethod("getJavaClass", PUBLIC).setType(new ClassOrInterfaceType(null, new SimpleName(Class.class.getName()), NodeList.nodeList(new ClassOrInterfaceType(null, javaType)))).setBody(new BlockStmt().addStatement(new ReturnStmt(new ClassExpr(new ClassOrInterfaceType(null, javaType)))));
            BlockStmt encodeBlock = new BlockStmt().addStatement(new IfStmt(new BinaryExpr(new NullLiteralExpr(), new NameExpr(STATE_PARAM), EQUALS), new ThrowStmt(new ObjectCreationExpr(null, new ClassOrInterfaceType(null, IllegalArgumentException.class.getName()), NodeList.nodeList(new StringLiteralExpr("Invalid value provided to enum")))), null)).addStatement(new ReturnStmt(new MethodCallExpr(new NameExpr(STATE_PARAM), "ordinal")));
            classDeclaration.addMethod("encode", PUBLIC).setType("int").addParameter(javaType, STATE_PARAM).setBody(encodeBlock);
            MethodDeclaration decode = classDeclaration.addMethod("decode", PUBLIC).setType(javaType).addParameter("int", "value");
            SwitchStmt decodeSwitch = new SwitchStmt().setSelector(new NameExpr("value"));
            msg.getValues().forEach(v -> {
                SwitchEntry dEntry = new SwitchEntry();
                dEntry.getLabels().add(new IntegerLiteralExpr(v.getNumber()));
                dEntry.addStatement(new ReturnStmt(new NameExpr(javaType + "." + v.getName())));
                decodeSwitch.getEntries().add(dEntry);
            });
            decodeSwitch.getEntries().add(new SwitchEntry().addStatement(new ThrowStmt(new ObjectCreationExpr(null, new ClassOrInterfaceType(null, IllegalArgumentException.class.getName()), NodeList.nodeList(new StringLiteralExpr("Invalid value provided to enum"))))));
            decode.setBody(new BlockStmt().addStatement(decodeSwitch));
        }
    }
    return units;
}
Also used : TemplatedGenerator(org.kie.kogito.codegen.api.template.TemplatedGenerator) ClassExpr(com.github.javaparser.ast.expr.ClassExpr) ClassOrInterfaceType(com.github.javaparser.ast.type.ClassOrInterfaceType) NullLiteralExpr(com.github.javaparser.ast.expr.NullLiteralExpr) EQUALS(com.github.javaparser.ast.expr.BinaryExpr.Operator.EQUALS) ExclusionTypeUtils(org.kie.kogito.codegen.process.persistence.ExclusionTypeUtils) ObjectCreationExpr(com.github.javaparser.ast.expr.ObjectCreationExpr) Map(java.util.Map) SerializationContextImpl(org.infinispan.protostream.impl.SerializationContextImpl) Expression(com.github.javaparser.ast.expr.Expression) CompilationUnit(com.github.javaparser.ast.CompilationUnit) BinaryExpr(com.github.javaparser.ast.expr.BinaryExpr) NodeList(com.github.javaparser.ast.NodeList) SimpleName(com.github.javaparser.ast.expr.SimpleName) KogitoBuildContext(org.kie.kogito.codegen.api.context.KogitoBuildContext) Predicate(java.util.function.Predicate) Collection(java.util.Collection) MethodCallExpr(com.github.javaparser.ast.expr.MethodCallExpr) KOGITO_JAVA_CLASS_OPTION(org.kie.kogito.codegen.process.persistence.proto.ProtoGenerator.KOGITO_JAVA_CLASS_OPTION) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) StringLiteralExpr(com.github.javaparser.ast.expr.StringLiteralExpr) FieldDescriptor(org.infinispan.protostream.descriptors.FieldDescriptor) EnclosedExpr(com.github.javaparser.ast.expr.EnclosedExpr) String.format(java.lang.String.format) Serializable(java.io.Serializable) VariableDeclarationExpr(com.github.javaparser.ast.expr.VariableDeclarationExpr) ThrowStmt(com.github.javaparser.ast.stmt.ThrowStmt) List(java.util.List) Entry(java.util.Map.Entry) BlockStmt(com.github.javaparser.ast.stmt.BlockStmt) ClassOrInterfaceDeclaration(com.github.javaparser.ast.body.ClassOrInterfaceDeclaration) SwitchEntry(com.github.javaparser.ast.stmt.SwitchEntry) ReturnStmt(com.github.javaparser.ast.stmt.ReturnStmt) EnumMarshaller(org.infinispan.protostream.EnumMarshaller) Descriptor(org.infinispan.protostream.descriptors.Descriptor) BodyDeclarationComparator(org.kie.kogito.codegen.core.BodyDeclarationComparator) CastExpr(com.github.javaparser.ast.expr.CastExpr) PUBLIC(com.github.javaparser.ast.Modifier.Keyword.PUBLIC) ArrayList(java.util.ArrayList) VariableDeclarator(com.github.javaparser.ast.body.VariableDeclarator) EnumDescriptor(org.infinispan.protostream.descriptors.EnumDescriptor) Option(org.infinispan.protostream.descriptors.Option) SwitchStmt(com.github.javaparser.ast.stmt.SwitchStmt) NoSuchElementException(java.util.NoSuchElementException) FileDescriptorSource(org.infinispan.protostream.FileDescriptorSource) FileDescriptor(org.infinispan.protostream.descriptors.FileDescriptor) InvalidTemplateException(org.kie.kogito.codegen.api.template.InvalidTemplateException) JavaKogitoBuildContext(org.kie.kogito.codegen.api.context.impl.JavaKogitoBuildContext) TemplatedGenerator(org.kie.kogito.codegen.api.template.TemplatedGenerator) IOException(java.io.IOException) NameExpr(com.github.javaparser.ast.expr.NameExpr) IfStmt(com.github.javaparser.ast.stmt.IfStmt) StringUtils(org.drools.util.StringUtils) MethodDeclaration(com.github.javaparser.ast.body.MethodDeclaration) Configuration(org.infinispan.protostream.config.Configuration) Collections(java.util.Collections) SerializationContext(org.infinispan.protostream.SerializationContext) IntegerLiteralExpr(com.github.javaparser.ast.expr.IntegerLiteralExpr) SerializationContext(org.infinispan.protostream.SerializationContext) ObjectCreationExpr(com.github.javaparser.ast.expr.ObjectCreationExpr) IntegerLiteralExpr(com.github.javaparser.ast.expr.IntegerLiteralExpr) Serializable(java.io.Serializable) ClassOrInterfaceDeclaration(com.github.javaparser.ast.body.ClassOrInterfaceDeclaration) SimpleName(com.github.javaparser.ast.expr.SimpleName) ArrayList(java.util.ArrayList) NameExpr(com.github.javaparser.ast.expr.NameExpr) StringLiteralExpr(com.github.javaparser.ast.expr.StringLiteralExpr) ClassOrInterfaceType(com.github.javaparser.ast.type.ClassOrInterfaceType) VariableDeclarator(com.github.javaparser.ast.body.VariableDeclarator) FieldDescriptor(org.infinispan.protostream.descriptors.FieldDescriptor) SerializationContextImpl(org.infinispan.protostream.impl.SerializationContextImpl) CastExpr(com.github.javaparser.ast.expr.CastExpr) BodyDeclarationComparator(org.kie.kogito.codegen.core.BodyDeclarationComparator) SwitchEntry(com.github.javaparser.ast.stmt.SwitchEntry) FileDescriptorSource(org.infinispan.protostream.FileDescriptorSource) CompilationUnit(com.github.javaparser.ast.CompilationUnit) VariableDeclarationExpr(com.github.javaparser.ast.expr.VariableDeclarationExpr) SwitchStmt(com.github.javaparser.ast.stmt.SwitchStmt) MethodDeclaration(com.github.javaparser.ast.body.MethodDeclaration) BlockStmt(com.github.javaparser.ast.stmt.BlockStmt) BinaryExpr(com.github.javaparser.ast.expr.BinaryExpr) EnumDescriptor(org.infinispan.protostream.descriptors.EnumDescriptor) FileDescriptor(org.infinispan.protostream.descriptors.FileDescriptor) InvalidTemplateException(org.kie.kogito.codegen.api.template.InvalidTemplateException) NullLiteralExpr(com.github.javaparser.ast.expr.NullLiteralExpr) IfStmt(com.github.javaparser.ast.stmt.IfStmt) Expression(com.github.javaparser.ast.expr.Expression) FieldDescriptor(org.infinispan.protostream.descriptors.FieldDescriptor) Descriptor(org.infinispan.protostream.descriptors.Descriptor) EnumDescriptor(org.infinispan.protostream.descriptors.EnumDescriptor) FileDescriptor(org.infinispan.protostream.descriptors.FileDescriptor) ClassExpr(com.github.javaparser.ast.expr.ClassExpr) EnclosedExpr(com.github.javaparser.ast.expr.EnclosedExpr) ReturnStmt(com.github.javaparser.ast.stmt.ReturnStmt) ThrowStmt(com.github.javaparser.ast.stmt.ThrowStmt) NoSuchElementException(java.util.NoSuchElementException) MethodCallExpr(com.github.javaparser.ast.expr.MethodCallExpr)

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