Netty Protobuf 例
Netty权威指南 第八章 生成Protobuf java类:
目录结构:

生成以后的文件正常用,爆红只是因为生成的if不带大括号阿里规约提示,或者某些其它规范性的提示:

proto文件:
如果是用proto3的话需要修改 syntax = "proto2";为syntax = "proto3";然后去掉required。
SubscribeReq.proto
syntax = "proto2"; package com.zang.protobuf; option java_package = "com.zang.protobuf"; option java_outer_classname = "SubscribeReqProto"; message SubscribeReq{ required int32 subReqId = 1; required string userName = 2; required string productName = 3; repeated string address = 4; }
SubscribeResp.proto
syntax = "proto2";
package com.zang.protobuf;
option java_package = "com.zang.protobuf";
option java_outer_classname = "SubscribeRespProto";
message SubscribeResp{
required int32 subReqId = 1;
required int32 respCode = 2;
repeated string desc = 3;
}
生成:


生成的java文件,估计是因为实在太多了,所以原书没贴代码,前方高能预警:
SubscribeRespProto:
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: SubscribeResp.proto
package com.zang.protobuf;
public final class SubscribeRespProto {
private SubscribeRespProto() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistryLite registry) {
}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
registerAllExtensions(
(com.google.protobuf.ExtensionRegistryLite) registry);
}
public interface SubscribeRespOrBuilder extends
// @@protoc_insertion_point(interface_extends:com.zang.protobuf.SubscribeResp)
com.google.protobuf.MessageOrBuilder {
/**
* <code>required int32 subReqId = 1;</code>
*/
boolean hasSubReqId();
/**
* <code>required int32 subReqId = 1;</code>
*/
int getSubReqId();
/**
* <code>required int32 respCode = 2;</code>
*/
boolean hasRespCode();
/**
* <code>required int32 respCode = 2;</code>
*/
int getRespCode();
/**
* <code>repeated string desc = 3;</code>
*/
java.util.List<String>
getDescList();
/**
* <code>repeated string desc = 3;</code>
*/
int getDescCount();
/**
* <code>repeated string desc = 3;</code>
*/
String getDesc(int index);
/**
* <code>repeated string desc = 3;</code>
*/
com.google.protobuf.ByteString
getDescBytes(int index);
}
/**
* Protobuf type {@code com.zang.protobuf.SubscribeResp}
*/
public static final class SubscribeResp extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:com.zang.protobuf.SubscribeResp)
SubscribeRespOrBuilder {
private static final long serialVersionUID = 0L;
// Use SubscribeResp.newBuilder() to construct.
private SubscribeResp(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private SubscribeResp() {
subReqId_ = 0;
respCode_ = 0;
desc_ = com.google.protobuf.LazyStringArrayList.EMPTY;
}
@Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private SubscribeResp(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new NullPointerException();
}
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 8: {
bitField0_ |= 0x00000001;
subReqId_ = input.readInt32();
break;
}
case 16: {
bitField0_ |= 0x00000002;
respCode_ = input.readInt32();
break;
}
case 26: {
com.google.protobuf.ByteString bs = input.readBytes();
if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
desc_ = new com.google.protobuf.LazyStringArrayList();
mutable_bitField0_ |= 0x00000004;
}
desc_.add(bs);
break;
}
default: {
if (!parseUnknownField(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
desc_ = desc_.getUnmodifiableView();
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return SubscribeRespProto.internal_static_com_zang_protobuf_SubscribeResp_descriptor;
}
@Override
protected FieldAccessorTable
internalGetFieldAccessorTable() {
return SubscribeRespProto.internal_static_com_zang_protobuf_SubscribeResp_fieldAccessorTable
.ensureFieldAccessorsInitialized(
SubscribeResp.class, Builder.class);
}
private int bitField0_;
public static final int SUBREQID_FIELD_NUMBER = 1;
private int subReqId_;
/**
* <code>required int32 subReqId = 1;</code>
*/
public boolean hasSubReqId() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int32 subReqId = 1;</code>
*/
public int getSubReqId() {
return subReqId_;
}
public static final int RESPCODE_FIELD_NUMBER = 2;
private int respCode_;
/**
* <code>required int32 respCode = 2;</code>
*/
public boolean hasRespCode() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required int32 respCode = 2;</code>
*/
public int getRespCode() {
return respCode_;
}
public static final int DESC_FIELD_NUMBER = 3;
private com.google.protobuf.LazyStringList desc_;
/**
* <code>repeated string desc = 3;</code>
*/
public com.google.protobuf.ProtocolStringList
getDescList() {
return desc_;
}
/**
* <code>repeated string desc = 3;</code>
*/
public int getDescCount() {
return desc_.size();
}
/**
* <code>repeated string desc = 3;</code>
*/
public String getDesc(int index) {
return desc_.get(index);
}
/**
* <code>repeated string desc = 3;</code>
*/
public com.google.protobuf.ByteString
getDescBytes(int index) {
return desc_.getByteString(index);
}
private byte memoizedIsInitialized = -1;
@Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (!hasSubReqId()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasRespCode()) {
memoizedIsInitialized = 0;
return false;
}
memoizedIsInitialized = 1;
return true;
}
@Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeInt32(1, subReqId_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeInt32(2, respCode_);
}
for (int i = 0; i < desc_.size(); i++) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 3, desc_.getRaw(i));
}
unknownFields.writeTo(output);
}
@Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(1, subReqId_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(2, respCode_);
}
{
int dataSize = 0;
for (int i = 0; i < desc_.size(); i++) {
dataSize += computeStringSizeNoTag(desc_.getRaw(i));
}
size += dataSize;
size += 1 * getDescList().size();
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@Override
public boolean equals(final Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof SubscribeResp)) {
return super.equals(obj);
}
SubscribeResp other = (SubscribeResp) obj;
boolean result = true;
result = result && (hasSubReqId() == other.hasSubReqId());
if (hasSubReqId()) {
result = result && (getSubReqId()
== other.getSubReqId());
}
result = result && (hasRespCode() == other.hasRespCode());
if (hasRespCode()) {
result = result && (getRespCode()
== other.getRespCode());
}
result = result && getDescList()
.equals(other.getDescList());
result = result && unknownFields.equals(other.unknownFields);
return result;
}
@Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
if (hasSubReqId()) {
hash = (37 * hash) + SUBREQID_FIELD_NUMBER;
hash = (53 * hash) + getSubReqId();
}
if (hasRespCode()) {
hash = (37 * hash) + RESPCODE_FIELD_NUMBER;
hash = (53 * hash) + getRespCode();
}
if (getDescCount() > 0) {
hash = (37 * hash) + DESC_FIELD_NUMBER;
hash = (53 * hash) + getDescList().hashCode();
}
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static SubscribeResp parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static SubscribeResp parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static SubscribeResp parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static SubscribeResp parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static SubscribeResp parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static SubscribeResp parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static SubscribeResp parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static SubscribeResp parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static SubscribeResp parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static SubscribeResp parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static SubscribeResp parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static SubscribeResp parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
@Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(SubscribeResp prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@Override
protected Builder newBuilderForType(
BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code com.zang.protobuf.SubscribeResp}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:com.zang.protobuf.SubscribeResp)
SubscribeRespOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return SubscribeRespProto.internal_static_com_zang_protobuf_SubscribeResp_descriptor;
}
@Override
protected FieldAccessorTable
internalGetFieldAccessorTable() {
return SubscribeRespProto.internal_static_com_zang_protobuf_SubscribeResp_fieldAccessorTable
.ensureFieldAccessorsInitialized(
SubscribeResp.class, Builder.class);
}
// Construct using com.zang.protobuf.SubscribeRespProto.SubscribeResp.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
@Override
public Builder clear() {
super.clear();
subReqId_ = 0;
bitField0_ = (bitField0_ & ~0x00000001);
respCode_ = 0;
bitField0_ = (bitField0_ & ~0x00000002);
desc_ = com.google.protobuf.LazyStringArrayList.EMPTY;
bitField0_ = (bitField0_ & ~0x00000004);
return this;
}
@Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return SubscribeRespProto.internal_static_com_zang_protobuf_SubscribeResp_descriptor;
}
@Override
public SubscribeResp getDefaultInstanceForType() {
return SubscribeResp.getDefaultInstance();
}
@Override
public SubscribeResp build() {
SubscribeResp result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@Override
public SubscribeResp buildPartial() {
SubscribeResp result = new SubscribeResp(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.subReqId_ = subReqId_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
result.respCode_ = respCode_;
if (((bitField0_ & 0x00000004) == 0x00000004)) {
desc_ = desc_.getUnmodifiableView();
bitField0_ = (bitField0_ & ~0x00000004);
}
result.desc_ = desc_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
@Override
public Builder clone() {
return (Builder) super.clone();
}
@Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) {
return (Builder) super.setField(field, value);
}
@Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return (Builder) super.clearField(field);
}
@Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return (Builder) super.clearOneof(oneof);
}
@Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, Object value) {
return (Builder) super.setRepeatedField(field, index, value);
}
@Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) {
return (Builder) super.addRepeatedField(field, value);
}
@Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof SubscribeResp) {
return mergeFrom((SubscribeResp)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(SubscribeResp other) {
if (other == SubscribeResp.getDefaultInstance()) return this;
if (other.hasSubReqId()) {
setSubReqId(other.getSubReqId());
}
if (other.hasRespCode()) {
setRespCode(other.getRespCode());
}
if (!other.desc_.isEmpty()) {
if (desc_.isEmpty()) {
desc_ = other.desc_;
bitField0_ = (bitField0_ & ~0x00000004);
} else {
ensureDescIsMutable();
desc_.addAll(other.desc_);
}
onChanged();
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
@Override
public final boolean isInitialized() {
if (!hasSubReqId()) {
return false;
}
if (!hasRespCode()) {
return false;
}
return true;
}
@Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
SubscribeResp parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (SubscribeResp) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private int subReqId_ ;
/**
* <code>required int32 subReqId = 1;</code>
*/
public boolean hasSubReqId() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int32 subReqId = 1;</code>
*/
public int getSubReqId() {
return subReqId_;
}
/**
* <code>required int32 subReqId = 1;</code>
*/
public Builder setSubReqId(int value) {
bitField0_ |= 0x00000001;
subReqId_ = value;
onChanged();
return this;
}
/**
* <code>required int32 subReqId = 1;</code>
*/
public Builder clearSubReqId() {
bitField0_ = (bitField0_ & ~0x00000001);
subReqId_ = 0;
onChanged();
return this;
}
private int respCode_ ;
/**
* <code>required int32 respCode = 2;</code>
*/
public boolean hasRespCode() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required int32 respCode = 2;</code>
*/
public int getRespCode() {
return respCode_;
}
/**
* <code>required int32 respCode = 2;</code>
*/
public Builder setRespCode(int value) {
bitField0_ |= 0x00000002;
respCode_ = value;
onChanged();
return this;
}
/**
* <code>required int32 respCode = 2;</code>
*/
public Builder clearRespCode() {
bitField0_ = (bitField0_ & ~0x00000002);
respCode_ = 0;
onChanged();
return this;
}
private com.google.protobuf.LazyStringList desc_ = com.google.protobuf.LazyStringArrayList.EMPTY;
private void ensureDescIsMutable() {
if (!((bitField0_ & 0x00000004) == 0x00000004)) {
desc_ = new com.google.protobuf.LazyStringArrayList(desc_);
bitField0_ |= 0x00000004;
}
}
/**
* <code>repeated string desc = 3;</code>
*/
public com.google.protobuf.ProtocolStringList
getDescList() {
return desc_.getUnmodifiableView();
}
/**
* <code>repeated string desc = 3;</code>
*/
public int getDescCount() {
return desc_.size();
}
/**
* <code>repeated string desc = 3;</code>
*/
public String getDesc(int index) {
return desc_.get(index);
}
/**
* <code>repeated string desc = 3;</code>
*/
public com.google.protobuf.ByteString
getDescBytes(int index) {
return desc_.getByteString(index);
}
/**
* <code>repeated string desc = 3;</code>
*/
public Builder setDesc(
int index, String value) {
if (value == null) {
throw new NullPointerException();
}
ensureDescIsMutable();
desc_.set(index, value);
onChanged();
return this;
}
/**
* <code>repeated string desc = 3;</code>
*/
public Builder addDesc(
String value) {
if (value == null) {
throw new NullPointerException();
}
ensureDescIsMutable();
desc_.add(value);
onChanged();
return this;
}
/**
* <code>repeated string desc = 3;</code>
*/
public Builder addAllDesc(
Iterable<String> values) {
ensureDescIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, desc_);
onChanged();
return this;
}
/**
* <code>repeated string desc = 3;</code>
*/
public Builder clearDesc() {
desc_ = com.google.protobuf.LazyStringArrayList.EMPTY;
bitField0_ = (bitField0_ & ~0x00000004);
onChanged();
return this;
}
/**
* <code>repeated string desc = 3;</code>
*/
public Builder addDescBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
ensureDescIsMutable();
desc_.add(value);
onChanged();
return this;
}
@Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:com.zang.protobuf.SubscribeResp)
}
// @@protoc_insertion_point(class_scope:com.zang.protobuf.SubscribeResp)
private static final SubscribeResp DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new SubscribeResp();
}
public static SubscribeResp getDefaultInstance() {
return DEFAULT_INSTANCE;
}
@Deprecated public static final com.google.protobuf.Parser<SubscribeResp>
PARSER = new com.google.protobuf.AbstractParser<SubscribeResp>() {
@Override
public SubscribeResp parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new SubscribeResp(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<SubscribeResp> parser() {
return PARSER;
}
@Override
public com.google.protobuf.Parser<SubscribeResp> getParserForType() {
return PARSER;
}
@Override
public SubscribeResp getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_com_zang_protobuf_SubscribeResp_descriptor;
private static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_com_zang_protobuf_SubscribeResp_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static com.google.protobuf.Descriptors.FileDescriptor
descriptor;
static {
String[] descriptorData = {
"\n\023SubscribeResp.proto\022\021com.zang.protobuf" +
"\"A\n\rSubscribeResp\022\020\n\010subReqId\030\001 \002(\005\022\020\n\010r" +
"espCode\030\002 \002(\005\022\014\n\004desc\030\003 \003(\tB\'\n\021com.zang." +
"protobufB\022SubscribeRespProto"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
public com.google.protobuf.ExtensionRegistry assignDescriptors(
com.google.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
return null;
}
};
com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
}, assigner);
internal_static_com_zang_protobuf_SubscribeResp_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_com_zang_protobuf_SubscribeResp_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_com_zang_protobuf_SubscribeResp_descriptor,
new String[] { "SubReqId", "RespCode", "Desc", });
}
// @@protoc_insertion_point(outer_class_scope)
}
SubscribeReqProto:
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: SubscribeReq.proto
package com.zang.protobuf;
public final class SubscribeReqProto {
private SubscribeReqProto() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistryLite registry) {
}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
registerAllExtensions(
(com.google.protobuf.ExtensionRegistryLite) registry);
}
public interface SubscribeReqOrBuilder extends
// @@protoc_insertion_point(interface_extends:com.zang.protobuf.SubscribeReq)
com.google.protobuf.MessageOrBuilder {
/**
* <code>required int32 subReqId = 1;</code>
*/
boolean hasSubReqId();
/**
* <code>required int32 subReqId = 1;</code>
*/
int getSubReqId();
/**
* <code>required string userName = 2;</code>
*/
boolean hasUserName();
/**
* <code>required string userName = 2;</code>
*/
String getUserName();
/**
* <code>required string userName = 2;</code>
*/
com.google.protobuf.ByteString
getUserNameBytes();
/**
* <code>required string productName = 3;</code>
*/
boolean hasProductName();
/**
* <code>required string productName = 3;</code>
*/
String getProductName();
/**
* <code>required string productName = 3;</code>
*/
com.google.protobuf.ByteString
getProductNameBytes();
/**
* <code>repeated string address = 4;</code>
*/
java.util.List<String>
getAddressList();
/**
* <code>repeated string address = 4;</code>
*/
int getAddressCount();
/**
* <code>repeated string address = 4;</code>
*/
String getAddress(int index);
/**
* <code>repeated string address = 4;</code>
*/
com.google.protobuf.ByteString
getAddressBytes(int index);
}
/**
* Protobuf type {@code com.zang.protobuf.SubscribeReq}
*/
public static final class SubscribeReq extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:com.zang.protobuf.SubscribeReq)
SubscribeReqOrBuilder {
private static final long serialVersionUID = 0L;
// Use SubscribeReq.newBuilder() to construct.
private SubscribeReq(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private SubscribeReq() {
subReqId_ = 0;
userName_ = "";
productName_ = "";
address_ = com.google.protobuf.LazyStringArrayList.EMPTY;
}
@Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private SubscribeReq(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new NullPointerException();
}
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 8: {
bitField0_ |= 0x00000001;
subReqId_ = input.readInt32();
break;
}
case 18: {
com.google.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000002;
userName_ = bs;
break;
}
case 26: {
com.google.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000004;
productName_ = bs;
break;
}
case 34: {
com.google.protobuf.ByteString bs = input.readBytes();
if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
address_ = new com.google.protobuf.LazyStringArrayList();
mutable_bitField0_ |= 0x00000008;
}
address_.add(bs);
break;
}
default: {
if (!parseUnknownField(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
address_ = address_.getUnmodifiableView();
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return SubscribeReqProto.internal_static_com_zang_protobuf_SubscribeReq_descriptor;
}
@Override
protected FieldAccessorTable
internalGetFieldAccessorTable() {
return SubscribeReqProto.internal_static_com_zang_protobuf_SubscribeReq_fieldAccessorTable
.ensureFieldAccessorsInitialized(
SubscribeReq.class, Builder.class);
}
private int bitField0_;
public static final int SUBREQID_FIELD_NUMBER = 1;
private int subReqId_;
/**
* <code>required int32 subReqId = 1;</code>
*/
public boolean hasSubReqId() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int32 subReqId = 1;</code>
*/
public int getSubReqId() {
return subReqId_;
}
public static final int USERNAME_FIELD_NUMBER = 2;
private volatile Object userName_;
/**
* <code>required string userName = 2;</code>
*/
public boolean hasUserName() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required string userName = 2;</code>
*/
public String getUserName() {
Object ref = userName_;
if (ref instanceof String) {
return (String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
userName_ = s;
}
return s;
}
}
/**
* <code>required string userName = 2;</code>
*/
public com.google.protobuf.ByteString
getUserNameBytes() {
Object ref = userName_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(String) ref);
userName_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int PRODUCTNAME_FIELD_NUMBER = 3;
private volatile Object productName_;
/**
* <code>required string productName = 3;</code>
*/
public boolean hasProductName() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>required string productName = 3;</code>
*/
public String getProductName() {
Object ref = productName_;
if (ref instanceof String) {
return (String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
productName_ = s;
}
return s;
}
}
/**
* <code>required string productName = 3;</code>
*/
public com.google.protobuf.ByteString
getProductNameBytes() {
Object ref = productName_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(String) ref);
productName_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int ADDRESS_FIELD_NUMBER = 4;
private com.google.protobuf.LazyStringList address_;
/**
* <code>repeated string address = 4;</code>
*/
public com.google.protobuf.ProtocolStringList
getAddressList() {
return address_;
}
/**
* <code>repeated string address = 4;</code>
*/
public int getAddressCount() {
return address_.size();
}
/**
* <code>repeated string address = 4;</code>
*/
public String getAddress(int index) {
return address_.get(index);
}
/**
* <code>repeated string address = 4;</code>
*/
public com.google.protobuf.ByteString
getAddressBytes(int index) {
return address_.getByteString(index);
}
private byte memoizedIsInitialized = -1;
@Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (!hasSubReqId()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasUserName()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasProductName()) {
memoizedIsInitialized = 0;
return false;
}
memoizedIsInitialized = 1;
return true;
}
@Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeInt32(1, subReqId_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 2, userName_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 3, productName_);
}
for (int i = 0; i < address_.size(); i++) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 4, address_.getRaw(i));
}
unknownFields.writeTo(output);
}
@Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(1, subReqId_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, userName_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, productName_);
}
{
int dataSize = 0;
for (int i = 0; i < address_.size(); i++) {
dataSize += computeStringSizeNoTag(address_.getRaw(i));
}
size += dataSize;
size += 1 * getAddressList().size();
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@Override
public boolean equals(final Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof SubscribeReq)) {
return super.equals(obj);
}
SubscribeReq other = (SubscribeReq) obj;
boolean result = true;
result = result && (hasSubReqId() == other.hasSubReqId());
if (hasSubReqId()) {
result = result && (getSubReqId()
== other.getSubReqId());
}
result = result && (hasUserName() == other.hasUserName());
if (hasUserName()) {
result = result && getUserName()
.equals(other.getUserName());
}
result = result && (hasProductName() == other.hasProductName());
if (hasProductName()) {
result = result && getProductName()
.equals(other.getProductName());
}
result = result && getAddressList()
.equals(other.getAddressList());
result = result && unknownFields.equals(other.unknownFields);
return result;
}
@Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
if (hasSubReqId()) {
hash = (37 * hash) + SUBREQID_FIELD_NUMBER;
hash = (53 * hash) + getSubReqId();
}
if (hasUserName()) {
hash = (37 * hash) + USERNAME_FIELD_NUMBER;
hash = (53 * hash) + getUserName().hashCode();
}
if (hasProductName()) {
hash = (37 * hash) + PRODUCTNAME_FIELD_NUMBER;
hash = (53 * hash) + getProductName().hashCode();
}
if (getAddressCount() > 0) {
hash = (37 * hash) + ADDRESS_FIELD_NUMBER;
hash = (53 * hash) + getAddressList().hashCode();
}
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static SubscribeReq parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static SubscribeReq parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static SubscribeReq parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static SubscribeReq parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static SubscribeReq parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static SubscribeReq parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static SubscribeReq parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static SubscribeReq parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static SubscribeReq parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static SubscribeReq parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static SubscribeReq parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static SubscribeReq parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
@Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(SubscribeReq prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@Override
protected Builder newBuilderForType(
BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code com.zang.protobuf.SubscribeReq}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:com.zang.protobuf.SubscribeReq)
SubscribeReqOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return SubscribeReqProto.internal_static_com_zang_protobuf_SubscribeReq_descriptor;
}
@Override
protected FieldAccessorTable
internalGetFieldAccessorTable() {
return SubscribeReqProto.internal_static_com_zang_protobuf_SubscribeReq_fieldAccessorTable
.ensureFieldAccessorsInitialized(
SubscribeReq.class, Builder.class);
}
// Construct using com.zang.protobuf.SubscribeReqProto.SubscribeReq.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
@Override
public Builder clear() {
super.clear();
subReqId_ = 0;
bitField0_ = (bitField0_ & ~0x00000001);
userName_ = "";
bitField0_ = (bitField0_ & ~0x00000002);
productName_ = "";
bitField0_ = (bitField0_ & ~0x00000004);
address_ = com.google.protobuf.LazyStringArrayList.EMPTY;
bitField0_ = (bitField0_ & ~0x00000008);
return this;
}
@Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return SubscribeReqProto.internal_static_com_zang_protobuf_SubscribeReq_descriptor;
}
@Override
public SubscribeReq getDefaultInstanceForType() {
return SubscribeReq.getDefaultInstance();
}
@Override
public SubscribeReq build() {
SubscribeReq result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@Override
public SubscribeReq buildPartial() {
SubscribeReq result = new SubscribeReq(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.subReqId_ = subReqId_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
result.userName_ = userName_;
if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
to_bitField0_ |= 0x00000004;
}
result.productName_ = productName_;
if (((bitField0_ & 0x00000008) == 0x00000008)) {
address_ = address_.getUnmodifiableView();
bitField0_ = (bitField0_ & ~0x00000008);
}
result.address_ = address_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
@Override
public Builder clone() {
return (Builder) super.clone();
}
@Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) {
return (Builder) super.setField(field, value);
}
@Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return (Builder) super.clearField(field);
}
@Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return (Builder) super.clearOneof(oneof);
}
@Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, Object value) {
return (Builder) super.setRepeatedField(field, index, value);
}
@Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) {
return (Builder) super.addRepeatedField(field, value);
}
@Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof SubscribeReq) {
return mergeFrom((SubscribeReq)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(SubscribeReq other) {
if (other == SubscribeReq.getDefaultInstance()) return this;
if (other.hasSubReqId()) {
setSubReqId(other.getSubReqId());
}
if (other.hasUserName()) {
bitField0_ |= 0x00000002;
userName_ = other.userName_;
onChanged();
}
if (other.hasProductName()) {
bitField0_ |= 0x00000004;
productName_ = other.productName_;
onChanged();
}
if (!other.address_.isEmpty()) {
if (address_.isEmpty()) {
address_ = other.address_;
bitField0_ = (bitField0_ & ~0x00000008);
} else {
ensureAddressIsMutable();
address_.addAll(other.address_);
}
onChanged();
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
@Override
public final boolean isInitialized() {
if (!hasSubReqId()) {
return false;
}
if (!hasUserName()) {
return false;
}
if (!hasProductName()) {
return false;
}
return true;
}
@Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
SubscribeReq parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (SubscribeReq) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private int subReqId_ ;
/**
* <code>required int32 subReqId = 1;</code>
*/
public boolean hasSubReqId() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int32 subReqId = 1;</code>
*/
public int getSubReqId() {
return subReqId_;
}
/**
* <code>required int32 subReqId = 1;</code>
*/
public Builder setSubReqId(int value) {
bitField0_ |= 0x00000001;
subReqId_ = value;
onChanged();
return this;
}
/**
* <code>required int32 subReqId = 1;</code>
*/
public Builder clearSubReqId() {
bitField0_ = (bitField0_ & ~0x00000001);
subReqId_ = 0;
onChanged();
return this;
}
private Object userName_ = "";
/**
* <code>required string userName = 2;</code>
*/
public boolean hasUserName() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required string userName = 2;</code>
*/
public String getUserName() {
Object ref = userName_;
if (!(ref instanceof String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
userName_ = s;
}
return s;
} else {
return (String) ref;
}
}
/**
* <code>required string userName = 2;</code>
*/
public com.google.protobuf.ByteString
getUserNameBytes() {
Object ref = userName_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(String) ref);
userName_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>required string userName = 2;</code>
*/
public Builder setUserName(
String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000002;
userName_ = value;
onChanged();
return this;
}
/**
* <code>required string userName = 2;</code>
*/
public Builder clearUserName() {
bitField0_ = (bitField0_ & ~0x00000002);
userName_ = getDefaultInstance().getUserName();
onChanged();
return this;
}
/**
* <code>required string userName = 2;</code>
*/
public Builder setUserNameBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000002;
userName_ = value;
onChanged();
return this;
}
private Object productName_ = "";
/**
* <code>required string productName = 3;</code>
*/
public boolean hasProductName() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>required string productName = 3;</code>
*/
public String getProductName() {
Object ref = productName_;
if (!(ref instanceof String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
productName_ = s;
}
return s;
} else {
return (String) ref;
}
}
/**
* <code>required string productName = 3;</code>
*/
public com.google.protobuf.ByteString
getProductNameBytes() {
Object ref = productName_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(String) ref);
productName_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>required string productName = 3;</code>
*/
public Builder setProductName(
String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000004;
productName_ = value;
onChanged();
return this;
}
/**
* <code>required string productName = 3;</code>
*/
public Builder clearProductName() {
bitField0_ = (bitField0_ & ~0x00000004);
productName_ = getDefaultInstance().getProductName();
onChanged();
return this;
}
/**
* <code>required string productName = 3;</code>
*/
public Builder setProductNameBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000004;
productName_ = value;
onChanged();
return this;
}
private com.google.protobuf.LazyStringList address_ = com.google.protobuf.LazyStringArrayList.EMPTY;
private void ensureAddressIsMutable() {
if (!((bitField0_ & 0x00000008) == 0x00000008)) {
address_ = new com.google.protobuf.LazyStringArrayList(address_);
bitField0_ |= 0x00000008;
}
}
/**
* <code>repeated string address = 4;</code>
*/
public com.google.protobuf.ProtocolStringList
getAddressList() {
return address_.getUnmodifiableView();
}
/**
* <code>repeated string address = 4;</code>
*/
public int getAddressCount() {
return address_.size();
}
/**
* <code>repeated string address = 4;</code>
*/
public String getAddress(int index) {
return address_.get(index);
}
/**
* <code>repeated string address = 4;</code>
*/
public com.google.protobuf.ByteString
getAddressBytes(int index) {
return address_.getByteString(index);
}
/**
* <code>repeated string address = 4;</code>
*/
public Builder setAddress(
int index, String value) {
if (value == null) {
throw new NullPointerException();
}
ensureAddressIsMutable();
address_.set(index, value);
onChanged();
return this;
}
/**
* <code>repeated string address = 4;</code>
*/
public Builder addAddress(
String value) {
if (value == null) {
throw new NullPointerException();
}
ensureAddressIsMutable();
address_.add(value);
onChanged();
return this;
}
/**
* <code>repeated string address = 4;</code>
*/
public Builder addAllAddress(
Iterable<String> values) {
ensureAddressIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, address_);
onChanged();
return this;
}
/**
* <code>repeated string address = 4;</code>
*/
public Builder clearAddress() {
address_ = com.google.protobuf.LazyStringArrayList.EMPTY;
bitField0_ = (bitField0_ & ~0x00000008);
onChanged();
return this;
}
/**
* <code>repeated string address = 4;</code>
*/
public Builder addAddressBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
ensureAddressIsMutable();
address_.add(value);
onChanged();
return this;
}
@Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:com.zang.protobuf.SubscribeReq)
}
// @@protoc_insertion_point(class_scope:com.zang.protobuf.SubscribeReq)
private static final SubscribeReq DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new SubscribeReq();
}
public static SubscribeReq getDefaultInstance() {
return DEFAULT_INSTANCE;
}
@Deprecated public static final com.google.protobuf.Parser<SubscribeReq>
PARSER = new com.google.protobuf.AbstractParser<SubscribeReq>() {
@Override
public SubscribeReq parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new SubscribeReq(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<SubscribeReq> parser() {
return PARSER;
}
@Override
public com.google.protobuf.Parser<SubscribeReq> getParserForType() {
return PARSER;
}
@Override
public SubscribeReq getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_com_zang_protobuf_SubscribeReq_descriptor;
private static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_com_zang_protobuf_SubscribeReq_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static com.google.protobuf.Descriptors.FileDescriptor
descriptor;
static {
String[] descriptorData = {
"\n\022SubscribeReq.proto\022\021com.zang.protobuf\"" +
"X\n\014SubscribeReq\022\020\n\010subReqId\030\001 \002(\005\022\020\n\010use" +
"rName\030\002 \002(\t\022\023\n\013productName\030\003 \002(\t\022\017\n\007addr" +
"ess\030\004 \003(\tB&\n\021com.zang.protobufB\021Subscrib" +
"eReqProto"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
public com.google.protobuf.ExtensionRegistry assignDescriptors(
com.google.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
return null;
}
};
com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
}, assigner);
internal_static_com_zang_protobuf_SubscribeReq_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_com_zang_protobuf_SubscribeReq_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_com_zang_protobuf_SubscribeReq_descriptor,
new String[] { "SubReqId", "UserName", "ProductName", "Address", });
}
// @@protoc_insertion_point(outer_class_scope)
}
以上可以拿来直接用,把包名和位置改一下即可
posted on 2019-07-22 17:17 GhostSugar 阅读(235) 评论(0) 收藏 举报
浙公网安备 33010602011771号