Search in sources :

Example 11 with EnumDescriptor

use of org.infinispan.protostream.descriptors.EnumDescriptor in project kogito-runtimes by kiegroup.

the class AbstractMarshallerGenerator method javaTypeForMessage.

protected String javaTypeForMessage(FileDescriptor d, String messageName, SerializationContext serializationContext) {
    Map<String, FileDescriptor> descriptors = serializationContext.getFileDescriptors();
    for (Entry<String, FileDescriptor> entry : descriptors.entrySet()) {
        List<Descriptor> messages = entry.getValue().getMessageTypes();
        for (Descriptor msg : messages) {
            if (messageName.equals(msg.getName())) {
                return packageFromOption(d, msg) + "." + messageName;
            } else if (messageName.equals(msg.getFullName())) {
                return packageFromOption(d, msg) + "." + msg.getName();
            }
        }
        List<EnumDescriptor> enums = entry.getValue().getEnumTypes();
        for (EnumDescriptor msg : enums) {
            if (messageName.equals(msg.getName())) {
                return packageFromOption(d, msg) + "." + messageName;
            } else if (messageName.equals(msg.getFullName())) {
                return packageFromOption(d, msg) + "." + msg.getName();
            }
        }
    }
    return null;
}
Also used : FieldDescriptor(org.infinispan.protostream.descriptors.FieldDescriptor) Descriptor(org.infinispan.protostream.descriptors.Descriptor) EnumDescriptor(org.infinispan.protostream.descriptors.EnumDescriptor) FileDescriptor(org.infinispan.protostream.descriptors.FileDescriptor) EnumDescriptor(org.infinispan.protostream.descriptors.EnumDescriptor) FileDescriptor(org.infinispan.protostream.descriptors.FileDescriptor)

Aggregations

EnumDescriptor (org.infinispan.protostream.descriptors.EnumDescriptor)11 Descriptor (org.infinispan.protostream.descriptors.Descriptor)6 FieldDescriptor (org.infinispan.protostream.descriptors.FieldDescriptor)5 FileDescriptor (org.infinispan.protostream.descriptors.FileDescriptor)5 EnumValueDescriptor (org.infinispan.protostream.descriptors.EnumValueDescriptor)4 GenericDescriptor (org.infinispan.protostream.descriptors.GenericDescriptor)4 IOException (java.io.IOException)3 FileDescriptorSource (org.infinispan.protostream.FileDescriptorSource)3 Test (org.junit.Test)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 Predicate (java.util.function.Predicate)2 Collectors (java.util.stream.Collectors)2 SerializationContext (org.infinispan.protostream.SerializationContext)2 AbstractProtoStreamTest (org.infinispan.protostream.test.AbstractProtoStreamTest)2 CompilationUnit (com.github.javaparser.ast.CompilationUnit)1 PUBLIC (com.github.javaparser.ast.Modifier.Keyword.PUBLIC)1 NodeList (com.github.javaparser.ast.NodeList)1