/** The syntax of the .proto file. */ public enum Syntax { UNKNOWN("unknown"), PROTO2("proto2"), PROTO3("proto3"); Syntax(String name) { this.name = name; } private final String name; }
result.setProto(proto);
/** * This method is to be called by generated code only. It is used to * update the FileDescriptorProto associated with the descriptor by * parsing it again with the given ExtensionRegistry. This is needed to * recognize custom options. */ public static void internalUpdateFileDescriptor( final FileDescriptor descriptor, final ExtensionRegistry registry) { ByteString bytes = descriptor.proto.toByteString(); FileDescriptorProto proto; try { proto = FileDescriptorProto.parseFrom(bytes, registry); } catch (InvalidProtocolBufferException e) { throw new IllegalArgumentException( "Failed to parse protocol buffer descriptor for generated code.", e); } descriptor.setProto(proto); }
result.setProto(proto);
/** * This method is to be called by generated code only. It is used to * update the FileDescriptorProto associated with the descriptor by * parsing it again with the given ExtensionRegistry. This is needed to * recognize custom options. */ public static void internalUpdateFileDescriptor( final FileDescriptor descriptor, final ExtensionRegistry registry) { ByteString bytes = descriptor.proto.toByteString(); FileDescriptorProto proto; try { proto = FileDescriptorProto.parseFrom(bytes, registry); } catch (InvalidProtocolBufferException e) { throw new IllegalArgumentException( "Failed to parse protocol buffer descriptor for generated code.", e); } descriptor.setProto(proto); }
/** * This method is to be called by generated code only. It is used to * update the FileDescriptorProto associated with the descriptor by * parsing it again with the given ExtensionRegistry. This is needed to * recognize custom options. */ public static void internalUpdateFileDescriptor( final FileDescriptor descriptor, final ExtensionRegistry registry) { ByteString bytes = descriptor.proto.toByteString(); FileDescriptorProto proto; try { proto = FileDescriptorProto.parseFrom(bytes, registry); } catch (InvalidProtocolBufferException e) { throw new IllegalArgumentException( "Failed to parse protocol buffer descriptor for generated code.", e); } descriptor.setProto(proto); }
/** The syntax of the .proto file. */ public enum Syntax { UNKNOWN("unknown"), PROTO2("proto2"), PROTO3("proto3"); Syntax(String name) { this.name = name; } private final String name; }
/** * Replace our {@link FileDescriptorProto} with the given one, which is * identical except that it might contain extensions that weren't present * in the original. This method is needed for bootstrapping when a file * defines custom options. The options may be defined in the file itself, * so we can't actually parse them until we've constructed the descriptors, * but to construct the descriptors we have to have parsed the descriptor * protos. So, we have to parse the descriptor protos a second time after * constructing the descriptors. */ private void setProto(final FileDescriptorProto proto) { this.proto = proto; for (int i = 0; i < messageTypes.length; i++) { messageTypes[i].setProto(proto.getMessageType(i)); } for (int i = 0; i < enumTypes.length; i++) { enumTypes[i].setProto(proto.getEnumType(i)); } for (int i = 0; i < services.length; i++) { services[i].setProto(proto.getService(i)); } for (int i = 0; i < extensions.length; i++) { extensions[i].setProto(proto.getExtension(i)); } } }