com.google.protobuf.Descriptors.GenericDescriptor Java Examples
The following examples show how to use
com.google.protobuf.Descriptors.GenericDescriptor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProtobufUtil.java From beam with Apache License 2.0 | 5 votes |
/** * Recursively walks the given {@link Message} class and verifies that every field or message * linked in uses the Protocol Buffers proto2 syntax. */ static void checkProto2Syntax(Class<? extends Message> clazz, ExtensionRegistry registry) { for (GenericDescriptor d : getRecursiveDescriptorsForClass(clazz, registry)) { Syntax s = d.getFile().getSyntax(); checkArgument( s == Syntax.PROTO2, "Message %s or one of its dependencies does not use proto2 syntax: %s in file %s", clazz.getName(), d.getFullName(), d.getFile().getName()); } }
Example #2
Source File: ProtobufUtilTest.java From beam with Apache License 2.0 | 5 votes |
/** Helper used to test the recursive class traversal and print good error messages. */ private static Set<String> getRecursiveDescriptorFullNames( Class<? extends Message> clazz, ExtensionRegistry registry) { Set<String> result = new HashSet<>(); for (GenericDescriptor d : getRecursiveDescriptorsForClass(clazz, registry)) { result.add(d.getFullName()); } return result; }
Example #3
Source File: TemplateRenderer.java From deploymentmanager-autogen with Apache License 2.0 | 4 votes |
/** Adds the descriptors for protos that will be used by the soy templates. */ public Builder addProtoDescriptors(GenericDescriptor... descriptors) { soyFileSetBuilder.addProtoDescriptors(descriptors); return this; }
Example #4
Source File: ProtoToGql.java From rejoiner with Apache License 2.0 | 4 votes |
/** Returns the GraphQL name of the supplied proto. */ static String getReferenceName(GenericDescriptor descriptor) { return CharMatcher.anyOf(".").replaceFrom(descriptor.getFullName(), "_"); }
Example #5
Source File: ProtoToGql.java From rejoiner with Apache License 2.0 | 4 votes |
/** Returns a reference to the GraphQL type corresponding to the supplied proto. */ static GraphQLTypeReference getReference(GenericDescriptor descriptor) { return new GraphQLTypeReference(getReferenceName(descriptor)); }
Example #6
Source File: Type.java From rejoiner with Apache License 2.0 | 4 votes |
/** Finds the GraphQL type for a Proto descriptor. */ public static ModifiableType find(GenericDescriptor typeDescriptor) { return new ModifiableType(ProtoToGql.getReferenceName(typeDescriptor)); }
Example #7
Source File: GqlInputConverter.java From rejoiner with Apache License 2.0 | 4 votes |
static String getReferenceName(GenericDescriptor descriptor) { return "Input_" + ProtoToGql.getReferenceName(descriptor); }