Java Code Examples for com.google.protobuf.DescriptorProtos.EnumValueDescriptorProto#Builder
The following examples show how to use
com.google.protobuf.DescriptorProtos.EnumValueDescriptorProto#Builder .
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: DescriptorGenerator.java From api-compiler with Apache License 2.0 | 5 votes |
private EnumDescriptorProto generateEnum(Enum e) { EnumDescriptorProto.Builder builder = EnumDescriptorProto.newBuilder(); builder.setName(getSimpleName(e.getName())); for (EnumValue value : e.getEnumvalueList()) { EnumValueDescriptorProto.Builder valueBuilder = EnumValueDescriptorProto.newBuilder(); valueBuilder.setName(value.getName()); valueBuilder.setNumber(value.getNumber()); valueBuilder.setOptions(generateEnumValueOptions(value)); builder.addValue(valueBuilder.build()); } builder.setOptions(generateEnumOptions(e)); return builder.build(); }
Example 2
Source File: BuilderVisitor.java From api-compiler with Apache License 2.0 | 4 votes |
@Accepts protected void accept(EnumValueDescriptorProto.Builder val) { pushParent(BuilderVisitorNodeInfo.create(val, currentFile)); visit(val.getOptionsBuilder()); popExpectedParent(val); }
Example 3
Source File: EnumDefinition.java From protobuf-dynamic with Apache License 2.0 | 4 votes |
public Builder addValue(String name, int num) { EnumValueDescriptorProto.Builder enumValBuilder = EnumValueDescriptorProto.newBuilder(); enumValBuilder.setName(name).setNumber(num); mEnumTypeBuilder.addValue(enumValBuilder.build()); return this; }