|
14 | 14 |
|
15 | 15 | package dev.cel.common; |
16 | 16 |
|
17 | | -import com.google.common.collect.ImmutableMap; |
18 | 17 | import com.google.common.collect.ImmutableSet; |
19 | 18 | import com.google.protobuf.DescriptorProtos.FileDescriptorSet; |
20 | 19 | import com.google.protobuf.Descriptors.Descriptor; |
21 | 20 | import com.google.protobuf.Descriptors.FieldDescriptor; |
22 | 21 | import com.google.protobuf.Descriptors.FileDescriptor; |
23 | | -import com.google.protobuf.Descriptors.GenericDescriptor; |
| 22 | +import dev.cel.common.annotations.Internal; |
24 | 23 | import dev.cel.common.internal.FileDescriptorSetConverter; |
25 | 24 | import dev.cel.common.types.CelTypes; |
26 | 25 | import java.util.Arrays; |
27 | | -import java.util.Collection; |
28 | 26 | import java.util.HashSet; |
29 | 27 | import java.util.Set; |
30 | 28 |
|
31 | | -/** Utility class for working with protobuf descriptors. */ |
| 29 | +/** |
| 30 | + * Utility class for working with protobuf descriptors. |
| 31 | + * |
| 32 | + * <p>CEL Library Internals. Do Not Use. |
| 33 | + */ |
| 34 | +@Internal |
32 | 35 | public final class CelDescriptorUtil { |
33 | 36 |
|
34 | 37 | private CelDescriptorUtil() {} |
35 | 38 |
|
36 | | - /** |
37 | | - * Converts descriptor collection to an ImmutableMap. |
38 | | - * |
39 | | - * <p>Key: Descriptor's full name, Value: Descriptor object |
40 | | - */ |
41 | | - public static <T extends GenericDescriptor> ImmutableMap<String, T> descriptorCollectionToMap( |
42 | | - Collection<T> descriptors) { |
43 | | - ImmutableMap.Builder<String, T> descriptorMapBuilder = new ImmutableMap.Builder<>(); |
44 | | - descriptors.forEach(d -> descriptorMapBuilder.put(d.getFullName(), d)); |
45 | | - return descriptorMapBuilder.buildOrThrow(); |
46 | | - } |
47 | | - |
48 | 39 | /** |
49 | 40 | * Get the full {@code FileDescriptor} set needed to accurately instantiate the {@code |
50 | 41 | * descriptors}. |
|
0 commit comments