Skip to content

Improve mapping from proto type to Java class #511

@alexander-yevsyukov

Description

@alexander-yevsyukov

The task of mapping a proto type to Java class was initially based on .properties files, which mapped a proto type name to a Java class name.

Then, we improved the generation, migrating to using descriptor set files, and building KnownTypes basing on them. It works better on the code generation side, but in order to unpack just one message from Any we need to load and build a very big thing.

We can probably do better, generating a Java class file which would have ImmutableMap from one string with a proto type name to another string to a Java class name. The name of the class would be a constant, which KnownTypes would use to load the class, and use its mapping for loading the classes.

There are may be other, better options. This issue was raised in the discussion of our Protobuf article for DOU (см. секцию «Собрание типов»).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions