Search in sources :

Example 1 with ImportedProtoTypeMetadata

use of org.infinispan.protostream.annotations.impl.ImportedProtoTypeMetadata in project protostream by infinispan.

the class CompileTimeProtoSchemaGenerator method importProtoTypeMetadata.

@Override
protected ProtoTypeMetadata importProtoTypeMetadata(XClass javaType) {
    if (javaType == typeFactory.fromClass(WrappedMessage.class)) {
        GenericDescriptor descriptor = serializationContext.getDescriptorByName(WrappedMessage.PROTOBUF_TYPE_NAME);
        BaseMarshaller<WrappedMessage> marshaller = serializationContext.getMarshaller(WrappedMessage.PROTOBUF_TYPE_NAME);
        return new ImportedProtoTypeMetadata(descriptor, marshaller, javaType);
    }
    String fileName = dependencies.get(javaType);
    if (fileName != null) {
        String packageName = serializationContext.getFileDescriptors().get(fileName).getPackage();
        return new CompileTimeImportedProtoTypeMetadata(makeTypeMetadata(javaType), packageName, fileName);
    }
    return null;
}
Also used : WrappedMessage(org.infinispan.protostream.WrappedMessage) ImportedProtoTypeMetadata(org.infinispan.protostream.annotations.impl.ImportedProtoTypeMetadata) GenericDescriptor(org.infinispan.protostream.descriptors.GenericDescriptor)

Aggregations

WrappedMessage (org.infinispan.protostream.WrappedMessage)1 ImportedProtoTypeMetadata (org.infinispan.protostream.annotations.impl.ImportedProtoTypeMetadata)1 GenericDescriptor (org.infinispan.protostream.descriptors.GenericDescriptor)1