public class MessageIndexFinder extends Object
| Constructor and Description |
|---|
MessageIndexFinder() |
| Modifier and Type | Method and Description |
|---|---|
protected com.google.common.collect.BiMap<com.google.protobuf.Descriptors.Descriptor,Integer> |
getAll(com.google.protobuf.Descriptors.FileDescriptor schemaDescriptor)
Parse the Protobuf Schema descriptor using level-order traversal,
sort the descriptors lexicographically and assign an index for each message type.
|
Integer |
getByDescriptor(com.google.protobuf.Descriptors.FileDescriptor schemaDescriptor,
com.google.protobuf.Descriptors.Descriptor descriptorToFind)
Parses the given Schema descriptor, assigns indices and finds the index for the given descriptor.
|
com.google.protobuf.Descriptors.Descriptor |
getByIndex(com.google.protobuf.Descriptors.FileDescriptor schemaDescriptor,
@NonNull Integer indexToFind)
Parses the given Schema descriptor, assigns indices and finds the descriptor for given Index.
|
public Integer getByDescriptor(@NonNull com.google.protobuf.Descriptors.FileDescriptor schemaDescriptor, @NonNull com.google.protobuf.Descriptors.Descriptor descriptorToFind)
schemaDescriptor - Protobuf Schema DescriptordescriptorToFind - Protobuf Descriptor to find.public com.google.protobuf.Descriptors.Descriptor getByIndex(@NonNull
com.google.protobuf.Descriptors.FileDescriptor schemaDescriptor,
@NonNull
@NonNull Integer indexToFind)
schemaDescriptor - Protobuf Schema DescriptorindexToFind - Index for the descriptor.protected com.google.common.collect.BiMap<com.google.protobuf.Descriptors.Descriptor,Integer> getAll(@NonNull com.google.protobuf.Descriptors.FileDescriptor schemaDescriptor)
TODO: Referencing other proto schemas using import statements is not supported yet. https://github.com/awslabs/aws-glue-schema-registry/issues/32
Example:
message B {
message C {
}
message A {
message D {
}
}
}
Assigned indices: B = 0, B.A = 1, B.A.D = 2, B.C = 3
schemaDescriptor - Protobuf Schema Descriptor.Copyright © 2024. All rights reserved.