com.redick.example.protocol.User Maven / Gradle / Ivy
The newest version!
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: message.proto
package com.redick.example.protocol;
/**
* Protobuf type {@code protocol.User}
*/
public final class User extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:protocol.User)
UserOrBuilder {
private static final long serialVersionUID = 0L;
// Use User.newBuilder() to construct.
private User(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
super(builder);
}
private User() {
username_ = "";
name_ = "";
userType_ = 0;
roles_ = emptyIntList();
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new User();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private User(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.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: {
userId_ = input.readInt32();
break;
}
case 18: {
java.lang.String s = input.readStringRequireUtf8();
username_ = s;
break;
}
case 26: {
java.lang.String s = input.readStringRequireUtf8();
msgCase_ = 3;
msg_ = s;
break;
}
case 32: {
msg_ = input.readInt32();
msgCase_ = 4;
break;
}
case 66: {
java.lang.String s = input.readStringRequireUtf8();
name_ = s;
break;
}
case 72: {
int rawValue = input.readEnum();
userType_ = rawValue;
break;
}
case 80: {
if (!((mutable_bitField0_ & 0x00000001) != 0)) {
roles_ = newIntList();
mutable_bitField0_ |= 0x00000001;
}
roles_.addInt(input.readInt32());
break;
}
case 82: {
int length = input.readRawVarint32();
int limit = input.pushLimit(length);
if (!((mutable_bitField0_ & 0x00000001) != 0) && input.getBytesUntilLimit() > 0) {
roles_ = newIntList();
mutable_bitField0_ |= 0x00000001;
}
while (input.getBytesUntilLimit() > 0) {
roles_.addInt(input.readInt32());
}
input.popLimit(limit);
break;
}
case 90: {
com.redick.example.protocol.FileOuterClass.File.Builder subBuilder = null;
if (file_ != null) {
subBuilder = file_.toBuilder();
}
file_ = input.readMessage(com.redick.example.protocol.FileOuterClass.File.parser(), extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(file_);
file_ = subBuilder.buildPartial();
}
break;
}
case 98: {
if (!((mutable_bitField0_ & 0x00000002) != 0)) {
hobbys_ = com.google.protobuf.MapField.newMapField(
HobbysDefaultEntryHolder.defaultEntry);
mutable_bitField0_ |= 0x00000002;
}
com.google.protobuf.MapEntry
hobbys__ = input.readMessage(
HobbysDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry);
hobbys_.getMutableMap().put(
hobbys__.getKey(), hobbys__.getValue());
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_ & 0x00000001) != 0)) {
roles_.makeImmutable(); // C
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.redick.example.protocol.Message.internal_static_protocol_User_descriptor;
}
@SuppressWarnings({"rawtypes"})
@java.lang.Override
protected com.google.protobuf.MapField internalGetMapField(
int number) {
switch (number) {
case 12:
return internalGetHobbys();
default:
throw new RuntimeException(
"Invalid map field number: " + number);
}
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.redick.example.protocol.Message.internal_static_protocol_User_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.redick.example.protocol.User.class, com.redick.example.protocol.User.Builder.class);
}
private int msgCase_ = 0;
private java.lang.Object msg_;
public enum MsgCase
implements com.google.protobuf.Internal.EnumLite,
com.google.protobuf.AbstractMessage.InternalOneOfEnum {
ERROR(3),
CODE(4),
MSG_NOT_SET(0);
private final int value;
private MsgCase(int value) {
this.value = value;
}
/**
* @param value The number of the enum to look for.
* @return The enum associated with the given number.
* @deprecated Use {@link #forNumber(int)} instead.
*/
@java.lang.Deprecated
public static MsgCase valueOf(int value) {
return forNumber(value);
}
public static MsgCase forNumber(int value) {
switch (value) {
case 3: return ERROR;
case 4: return CODE;
case 0: return MSG_NOT_SET;
default: return null;
}
}
public int getNumber() {
return this.value;
}
};
public MsgCase
getMsgCase() {
return MsgCase.forNumber(
msgCase_);
}
public static final int USERID_FIELD_NUMBER = 1;
private int userId_;
/**
* int32 userId = 1;
* @return The userId.
*/
@java.lang.Override
public int getUserId() {
return userId_;
}
public static final int USERNAME_FIELD_NUMBER = 2;
private volatile java.lang.Object username_;
/**
* string username = 2;
* @return The username.
*/
@java.lang.Override
public java.lang.String getUsername() {
java.lang.Object ref = username_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
username_ = s;
return s;
}
}
/**
* string username = 2;
* @return The bytes for username.
*/
@java.lang.Override
public com.google.protobuf.ByteString
getUsernameBytes() {
java.lang.Object ref = username_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
username_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int ERROR_FIELD_NUMBER = 3;
/**
* string error = 3;
* @return Whether the error field is set.
*/
public boolean hasError() {
return msgCase_ == 3;
}
/**
* string error = 3;
* @return The error.
*/
public java.lang.String getError() {
java.lang.Object ref = "";
if (msgCase_ == 3) {
ref = msg_;
}
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (msgCase_ == 3) {
msg_ = s;
}
return s;
}
}
/**
* string error = 3;
* @return The bytes for error.
*/
public com.google.protobuf.ByteString
getErrorBytes() {
java.lang.Object ref = "";
if (msgCase_ == 3) {
ref = msg_;
}
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
if (msgCase_ == 3) {
msg_ = b;
}
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int CODE_FIELD_NUMBER = 4;
/**
* int32 code = 4;
* @return Whether the code field is set.
*/
@java.lang.Override
public boolean hasCode() {
return msgCase_ == 4;
}
/**
* int32 code = 4;
* @return The code.
*/
@java.lang.Override
public int getCode() {
if (msgCase_ == 4) {
return (java.lang.Integer) msg_;
}
return 0;
}
public static final int NAME_FIELD_NUMBER = 8;
private volatile java.lang.Object name_;
/**
* string name = 8;
* @return The name.
*/
@java.lang.Override
public java.lang.String getName() {
java.lang.Object ref = name_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
name_ = s;
return s;
}
}
/**
* string name = 8;
* @return The bytes for name.
*/
@java.lang.Override
public com.google.protobuf.ByteString
getNameBytes() {
java.lang.Object ref = name_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
name_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int USERTYPE_FIELD_NUMBER = 9;
private int userType_;
/**
* .protocol.UserType userType = 9;
* @return The enum numeric value on the wire for userType.
*/
@java.lang.Override public int getUserTypeValue() {
return userType_;
}
/**
* .protocol.UserType userType = 9;
* @return The userType.
*/
@java.lang.Override public com.redick.example.protocol.UserType getUserType() {
@SuppressWarnings("deprecation")
com.redick.example.protocol.UserType result = com.redick.example.protocol.UserType.valueOf(userType_);
return result == null ? com.redick.example.protocol.UserType.UNRECOGNIZED : result;
}
public static final int ROLES_FIELD_NUMBER = 10;
private com.google.protobuf.Internal.IntList roles_;
/**
* repeated int32 roles = 10;
* @return A list containing the roles.
*/
@java.lang.Override
public java.util.List
getRolesList() {
return roles_;
}
/**
* repeated int32 roles = 10;
* @return The count of roles.
*/
public int getRolesCount() {
return roles_.size();
}
/**
* repeated int32 roles = 10;
* @param index The index of the element to return.
* @return The roles at the given index.
*/
public int getRoles(int index) {
return roles_.getInt(index);
}
private int rolesMemoizedSerializedSize = -1;
public static final int FILE_FIELD_NUMBER = 11;
private com.redick.example.protocol.FileOuterClass.File file_;
/**
* .protocol.File file = 11;
* @return Whether the file field is set.
*/
@java.lang.Override
public boolean hasFile() {
return file_ != null;
}
/**
* .protocol.File file = 11;
* @return The file.
*/
@java.lang.Override
public com.redick.example.protocol.FileOuterClass.File getFile() {
return file_ == null ? com.redick.example.protocol.FileOuterClass.File.getDefaultInstance() : file_;
}
/**
* .protocol.File file = 11;
*/
@java.lang.Override
public com.redick.example.protocol.FileOuterClass.FileOrBuilder getFileOrBuilder() {
return getFile();
}
public static final int HOBBYS_FIELD_NUMBER = 12;
private static final class HobbysDefaultEntryHolder {
static final com.google.protobuf.MapEntry<
java.lang.String, java.lang.String> defaultEntry =
com.google.protobuf.MapEntry
.newDefaultInstance(
com.redick.example.protocol.Message.internal_static_protocol_User_HobbysEntry_descriptor,
com.google.protobuf.WireFormat.FieldType.STRING,
"",
com.google.protobuf.WireFormat.FieldType.STRING,
"");
}
private com.google.protobuf.MapField<
java.lang.String, java.lang.String> hobbys_;
private com.google.protobuf.MapField
internalGetHobbys() {
if (hobbys_ == null) {
return com.google.protobuf.MapField.emptyMapField(
HobbysDefaultEntryHolder.defaultEntry);
}
return hobbys_;
}
public int getHobbysCount() {
return internalGetHobbys().getMap().size();
}
/**
* map<string, string> hobbys = 12;
*/
@java.lang.Override
public boolean containsHobbys(
java.lang.String key) {
if (key == null) { throw new NullPointerException("map key"); }
return internalGetHobbys().getMap().containsKey(key);
}
/**
* Use {@link #getHobbysMap()} instead.
*/
@java.lang.Override
@java.lang.Deprecated
public java.util.Map getHobbys() {
return getHobbysMap();
}
/**
* map<string, string> hobbys = 12;
*/
@java.lang.Override
public java.util.Map getHobbysMap() {
return internalGetHobbys().getMap();
}
/**
* map<string, string> hobbys = 12;
*/
@java.lang.Override
public java.lang.String getHobbysOrDefault(
java.lang.String key,
java.lang.String defaultValue) {
if (key == null) { throw new NullPointerException("map key"); }
java.util.Map map =
internalGetHobbys().getMap();
return map.containsKey(key) ? map.get(key) : defaultValue;
}
/**
* map<string, string> hobbys = 12;
*/
@java.lang.Override
public java.lang.String getHobbysOrThrow(
java.lang.String key) {
if (key == null) { throw new NullPointerException("map key"); }
java.util.Map map =
internalGetHobbys().getMap();
if (!map.containsKey(key)) {
throw new java.lang.IllegalArgumentException();
}
return map.get(key);
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (userId_ != 0) {
output.writeInt32(1, userId_);
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(username_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 2, username_);
}
if (msgCase_ == 3) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 3, msg_);
}
if (msgCase_ == 4) {
output.writeInt32(
4, (int)((java.lang.Integer) msg_));
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 8, name_);
}
if (userType_ != com.redick.example.protocol.UserType.UNKNOW.getNumber()) {
output.writeEnum(9, userType_);
}
if (getRolesList().size() > 0) {
output.writeUInt32NoTag(82);
output.writeUInt32NoTag(rolesMemoizedSerializedSize);
}
for (int i = 0; i < roles_.size(); i++) {
output.writeInt32NoTag(roles_.getInt(i));
}
if (file_ != null) {
output.writeMessage(11, getFile());
}
com.google.protobuf.GeneratedMessageV3
.serializeStringMapTo(
output,
internalGetHobbys(),
HobbysDefaultEntryHolder.defaultEntry,
12);
unknownFields.writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (userId_ != 0) {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(1, userId_);
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(username_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, username_);
}
if (msgCase_ == 3) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, msg_);
}
if (msgCase_ == 4) {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(
4, (int)((java.lang.Integer) msg_));
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(8, name_);
}
if (userType_ != com.redick.example.protocol.UserType.UNKNOW.getNumber()) {
size += com.google.protobuf.CodedOutputStream
.computeEnumSize(9, userType_);
}
{
int dataSize = 0;
for (int i = 0; i < roles_.size(); i++) {
dataSize += com.google.protobuf.CodedOutputStream
.computeInt32SizeNoTag(roles_.getInt(i));
}
size += dataSize;
if (!getRolesList().isEmpty()) {
size += 1;
size += com.google.protobuf.CodedOutputStream
.computeInt32SizeNoTag(dataSize);
}
rolesMemoizedSerializedSize = dataSize;
}
if (file_ != null) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(11, getFile());
}
for (java.util.Map.Entry entry
: internalGetHobbys().getMap().entrySet()) {
com.google.protobuf.MapEntry
hobbys__ = HobbysDefaultEntryHolder.defaultEntry.newBuilderForType()
.setKey(entry.getKey())
.setValue(entry.getValue())
.build();
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(12, hobbys__);
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof com.redick.example.protocol.User)) {
return super.equals(obj);
}
com.redick.example.protocol.User other = (com.redick.example.protocol.User) obj;
if (getUserId()
!= other.getUserId()) return false;
if (!getUsername()
.equals(other.getUsername())) return false;
if (!getName()
.equals(other.getName())) return false;
if (userType_ != other.userType_) return false;
if (!getRolesList()
.equals(other.getRolesList())) return false;
if (hasFile() != other.hasFile()) return false;
if (hasFile()) {
if (!getFile()
.equals(other.getFile())) return false;
}
if (!internalGetHobbys().equals(
other.internalGetHobbys())) return false;
if (!getMsgCase().equals(other.getMsgCase())) return false;
switch (msgCase_) {
case 3:
if (!getError()
.equals(other.getError())) return false;
break;
case 4:
if (getCode()
!= other.getCode()) return false;
break;
case 0:
default:
}
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + USERID_FIELD_NUMBER;
hash = (53 * hash) + getUserId();
hash = (37 * hash) + USERNAME_FIELD_NUMBER;
hash = (53 * hash) + getUsername().hashCode();
hash = (37 * hash) + NAME_FIELD_NUMBER;
hash = (53 * hash) + getName().hashCode();
hash = (37 * hash) + USERTYPE_FIELD_NUMBER;
hash = (53 * hash) + userType_;
if (getRolesCount() > 0) {
hash = (37 * hash) + ROLES_FIELD_NUMBER;
hash = (53 * hash) + getRolesList().hashCode();
}
if (hasFile()) {
hash = (37 * hash) + FILE_FIELD_NUMBER;
hash = (53 * hash) + getFile().hashCode();
}
if (!internalGetHobbys().getMap().isEmpty()) {
hash = (37 * hash) + HOBBYS_FIELD_NUMBER;
hash = (53 * hash) + internalGetHobbys().hashCode();
}
switch (msgCase_) {
case 3:
hash = (37 * hash) + ERROR_FIELD_NUMBER;
hash = (53 * hash) + getError().hashCode();
break;
case 4:
hash = (37 * hash) + CODE_FIELD_NUMBER;
hash = (53 * hash) + getCode();
break;
case 0:
default:
}
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static com.redick.example.protocol.User parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.redick.example.protocol.User parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.redick.example.protocol.User parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.redick.example.protocol.User parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.redick.example.protocol.User parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.redick.example.protocol.User parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.redick.example.protocol.User parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static com.redick.example.protocol.User 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 com.redick.example.protocol.User parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static com.redick.example.protocol.User 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 com.redick.example.protocol.User parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static com.redick.example.protocol.User parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(com.redick.example.protocol.User prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code protocol.User}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder implements
// @@protoc_insertion_point(builder_implements:protocol.User)
com.redick.example.protocol.UserOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.redick.example.protocol.Message.internal_static_protocol_User_descriptor;
}
@SuppressWarnings({"rawtypes"})
protected com.google.protobuf.MapField internalGetMapField(
int number) {
switch (number) {
case 12:
return internalGetHobbys();
default:
throw new RuntimeException(
"Invalid map field number: " + number);
}
}
@SuppressWarnings({"rawtypes"})
protected com.google.protobuf.MapField internalGetMutableMapField(
int number) {
switch (number) {
case 12:
return internalGetMutableHobbys();
default:
throw new RuntimeException(
"Invalid map field number: " + number);
}
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.redick.example.protocol.Message.internal_static_protocol_User_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.redick.example.protocol.User.class, com.redick.example.protocol.User.Builder.class);
}
// Construct using com.redick.example.protocol.User.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
@java.lang.Override
public Builder clear() {
super.clear();
userId_ = 0;
username_ = "";
name_ = "";
userType_ = 0;
roles_ = emptyIntList();
bitField0_ = (bitField0_ & ~0x00000001);
if (fileBuilder_ == null) {
file_ = null;
} else {
file_ = null;
fileBuilder_ = null;
}
internalGetMutableHobbys().clear();
msgCase_ = 0;
msg_ = null;
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.redick.example.protocol.Message.internal_static_protocol_User_descriptor;
}
@java.lang.Override
public com.redick.example.protocol.User getDefaultInstanceForType() {
return com.redick.example.protocol.User.getDefaultInstance();
}
@java.lang.Override
public com.redick.example.protocol.User build() {
com.redick.example.protocol.User result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public com.redick.example.protocol.User buildPartial() {
com.redick.example.protocol.User result = new com.redick.example.protocol.User(this);
int from_bitField0_ = bitField0_;
result.userId_ = userId_;
result.username_ = username_;
if (msgCase_ == 3) {
result.msg_ = msg_;
}
if (msgCase_ == 4) {
result.msg_ = msg_;
}
result.name_ = name_;
result.userType_ = userType_;
if (((bitField0_ & 0x00000001) != 0)) {
roles_.makeImmutable();
bitField0_ = (bitField0_ & ~0x00000001);
}
result.roles_ = roles_;
if (fileBuilder_ == null) {
result.file_ = file_;
} else {
result.file_ = fileBuilder_.build();
}
result.hobbys_ = internalGetHobbys();
result.hobbys_.makeImmutable();
result.msgCase_ = msgCase_;
onBuilt();
return result;
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.redick.example.protocol.User) {
return mergeFrom((com.redick.example.protocol.User)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.redick.example.protocol.User other) {
if (other == com.redick.example.protocol.User.getDefaultInstance()) return this;
if (other.getUserId() != 0) {
setUserId(other.getUserId());
}
if (!other.getUsername().isEmpty()) {
username_ = other.username_;
onChanged();
}
if (!other.getName().isEmpty()) {
name_ = other.name_;
onChanged();
}
if (other.userType_ != 0) {
setUserTypeValue(other.getUserTypeValue());
}
if (!other.roles_.isEmpty()) {
if (roles_.isEmpty()) {
roles_ = other.roles_;
bitField0_ = (bitField0_ & ~0x00000001);
} else {
ensureRolesIsMutable();
roles_.addAll(other.roles_);
}
onChanged();
}
if (other.hasFile()) {
mergeFile(other.getFile());
}
internalGetMutableHobbys().mergeFrom(
other.internalGetHobbys());
switch (other.getMsgCase()) {
case ERROR: {
msgCase_ = 3;
msg_ = other.msg_;
onChanged();
break;
}
case CODE: {
setCode(other.getCode());
break;
}
case MSG_NOT_SET: {
break;
}
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.redick.example.protocol.User parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.redick.example.protocol.User) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int msgCase_ = 0;
private java.lang.Object msg_;
public MsgCase
getMsgCase() {
return MsgCase.forNumber(
msgCase_);
}
public Builder clearMsg() {
msgCase_ = 0;
msg_ = null;
onChanged();
return this;
}
private int bitField0_;
private int userId_ ;
/**
* int32 userId = 1;
* @return The userId.
*/
@java.lang.Override
public int getUserId() {
return userId_;
}
/**
* int32 userId = 1;
* @param value The userId to set.
* @return This builder for chaining.
*/
public Builder setUserId(int value) {
userId_ = value;
onChanged();
return this;
}
/**
* int32 userId = 1;
* @return This builder for chaining.
*/
public Builder clearUserId() {
userId_ = 0;
onChanged();
return this;
}
private java.lang.Object username_ = "";
/**
* string username = 2;
* @return The username.
*/
public java.lang.String getUsername() {
java.lang.Object ref = username_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
username_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* string username = 2;
* @return The bytes for username.
*/
public com.google.protobuf.ByteString
getUsernameBytes() {
java.lang.Object ref = username_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
username_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* string username = 2;
* @param value The username to set.
* @return This builder for chaining.
*/
public Builder setUsername(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
username_ = value;
onChanged();
return this;
}
/**
* string username = 2;
* @return This builder for chaining.
*/
public Builder clearUsername() {
username_ = getDefaultInstance().getUsername();
onChanged();
return this;
}
/**
* string username = 2;
* @param value The bytes for username to set.
* @return This builder for chaining.
*/
public Builder setUsernameBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
username_ = value;
onChanged();
return this;
}
/**
* string error = 3;
* @return Whether the error field is set.
*/
@java.lang.Override
public boolean hasError() {
return msgCase_ == 3;
}
/**
* string error = 3;
* @return The error.
*/
@java.lang.Override
public java.lang.String getError() {
java.lang.Object ref = "";
if (msgCase_ == 3) {
ref = msg_;
}
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (msgCase_ == 3) {
msg_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* string error = 3;
* @return The bytes for error.
*/
@java.lang.Override
public com.google.protobuf.ByteString
getErrorBytes() {
java.lang.Object ref = "";
if (msgCase_ == 3) {
ref = msg_;
}
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
if (msgCase_ == 3) {
msg_ = b;
}
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* string error = 3;
* @param value The error to set.
* @return This builder for chaining.
*/
public Builder setError(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
msgCase_ = 3;
msg_ = value;
onChanged();
return this;
}
/**
* string error = 3;
* @return This builder for chaining.
*/
public Builder clearError() {
if (msgCase_ == 3) {
msgCase_ = 0;
msg_ = null;
onChanged();
}
return this;
}
/**
* string error = 3;
* @param value The bytes for error to set.
* @return This builder for chaining.
*/
public Builder setErrorBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
msgCase_ = 3;
msg_ = value;
onChanged();
return this;
}
/**
* int32 code = 4;
* @return Whether the code field is set.
*/
public boolean hasCode() {
return msgCase_ == 4;
}
/**
* int32 code = 4;
* @return The code.
*/
public int getCode() {
if (msgCase_ == 4) {
return (java.lang.Integer) msg_;
}
return 0;
}
/**
* int32 code = 4;
* @param value The code to set.
* @return This builder for chaining.
*/
public Builder setCode(int value) {
msgCase_ = 4;
msg_ = value;
onChanged();
return this;
}
/**
* int32 code = 4;
* @return This builder for chaining.
*/
public Builder clearCode() {
if (msgCase_ == 4) {
msgCase_ = 0;
msg_ = null;
onChanged();
}
return this;
}
private java.lang.Object name_ = "";
/**
* string name = 8;
* @return The name.
*/
public java.lang.String getName() {
java.lang.Object ref = name_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
name_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* string name = 8;
* @return The bytes for name.
*/
public com.google.protobuf.ByteString
getNameBytes() {
java.lang.Object ref = name_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
name_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* string name = 8;
* @param value The name to set.
* @return This builder for chaining.
*/
public Builder setName(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
name_ = value;
onChanged();
return this;
}
/**
* string name = 8;
* @return This builder for chaining.
*/
public Builder clearName() {
name_ = getDefaultInstance().getName();
onChanged();
return this;
}
/**
* string name = 8;
* @param value The bytes for name to set.
* @return This builder for chaining.
*/
public Builder setNameBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
name_ = value;
onChanged();
return this;
}
private int userType_ = 0;
/**
* .protocol.UserType userType = 9;
* @return The enum numeric value on the wire for userType.
*/
@java.lang.Override public int getUserTypeValue() {
return userType_;
}
/**
* .protocol.UserType userType = 9;
* @param value The enum numeric value on the wire for userType to set.
* @return This builder for chaining.
*/
public Builder setUserTypeValue(int value) {
userType_ = value;
onChanged();
return this;
}
/**
* .protocol.UserType userType = 9;
* @return The userType.
*/
@java.lang.Override
public com.redick.example.protocol.UserType getUserType() {
@SuppressWarnings("deprecation")
com.redick.example.protocol.UserType result = com.redick.example.protocol.UserType.valueOf(userType_);
return result == null ? com.redick.example.protocol.UserType.UNRECOGNIZED : result;
}
/**
* .protocol.UserType userType = 9;
* @param value The userType to set.
* @return This builder for chaining.
*/
public Builder setUserType(com.redick.example.protocol.UserType value) {
if (value == null) {
throw new NullPointerException();
}
userType_ = value.getNumber();
onChanged();
return this;
}
/**
* .protocol.UserType userType = 9;
* @return This builder for chaining.
*/
public Builder clearUserType() {
userType_ = 0;
onChanged();
return this;
}
private com.google.protobuf.Internal.IntList roles_ = emptyIntList();
private void ensureRolesIsMutable() {
if (!((bitField0_ & 0x00000001) != 0)) {
roles_ = mutableCopy(roles_);
bitField0_ |= 0x00000001;
}
}
/**
* repeated int32 roles = 10;
* @return A list containing the roles.
*/
public java.util.List
getRolesList() {
return ((bitField0_ & 0x00000001) != 0) ?
java.util.Collections.unmodifiableList(roles_) : roles_;
}
/**
* repeated int32 roles = 10;
* @return The count of roles.
*/
public int getRolesCount() {
return roles_.size();
}
/**
* repeated int32 roles = 10;
* @param index The index of the element to return.
* @return The roles at the given index.
*/
public int getRoles(int index) {
return roles_.getInt(index);
}
/**
* repeated int32 roles = 10;
* @param index The index to set the value at.
* @param value The roles to set.
* @return This builder for chaining.
*/
public Builder setRoles(
int index, int value) {
ensureRolesIsMutable();
roles_.setInt(index, value);
onChanged();
return this;
}
/**
* repeated int32 roles = 10;
* @param value The roles to add.
* @return This builder for chaining.
*/
public Builder addRoles(int value) {
ensureRolesIsMutable();
roles_.addInt(value);
onChanged();
return this;
}
/**
* repeated int32 roles = 10;
* @param values The roles to add.
* @return This builder for chaining.
*/
public Builder addAllRoles(
java.lang.Iterable extends java.lang.Integer> values) {
ensureRolesIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, roles_);
onChanged();
return this;
}
/**
* repeated int32 roles = 10;
* @return This builder for chaining.
*/
public Builder clearRoles() {
roles_ = emptyIntList();
bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
return this;
}
private com.redick.example.protocol.FileOuterClass.File file_;
private com.google.protobuf.SingleFieldBuilderV3<
com.redick.example.protocol.FileOuterClass.File, com.redick.example.protocol.FileOuterClass.File.Builder, com.redick.example.protocol.FileOuterClass.FileOrBuilder> fileBuilder_;
/**
* .protocol.File file = 11;
* @return Whether the file field is set.
*/
public boolean hasFile() {
return fileBuilder_ != null || file_ != null;
}
/**
* .protocol.File file = 11;
* @return The file.
*/
public com.redick.example.protocol.FileOuterClass.File getFile() {
if (fileBuilder_ == null) {
return file_ == null ? com.redick.example.protocol.FileOuterClass.File.getDefaultInstance() : file_;
} else {
return fileBuilder_.getMessage();
}
}
/**
* .protocol.File file = 11;
*/
public Builder setFile(com.redick.example.protocol.FileOuterClass.File value) {
if (fileBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
file_ = value;
onChanged();
} else {
fileBuilder_.setMessage(value);
}
return this;
}
/**
* .protocol.File file = 11;
*/
public Builder setFile(
com.redick.example.protocol.FileOuterClass.File.Builder builderForValue) {
if (fileBuilder_ == null) {
file_ = builderForValue.build();
onChanged();
} else {
fileBuilder_.setMessage(builderForValue.build());
}
return this;
}
/**
* .protocol.File file = 11;
*/
public Builder mergeFile(com.redick.example.protocol.FileOuterClass.File value) {
if (fileBuilder_ == null) {
if (file_ != null) {
file_ =
com.redick.example.protocol.FileOuterClass.File.newBuilder(file_).mergeFrom(value).buildPartial();
} else {
file_ = value;
}
onChanged();
} else {
fileBuilder_.mergeFrom(value);
}
return this;
}
/**
* .protocol.File file = 11;
*/
public Builder clearFile() {
if (fileBuilder_ == null) {
file_ = null;
onChanged();
} else {
file_ = null;
fileBuilder_ = null;
}
return this;
}
/**
* .protocol.File file = 11;
*/
public com.redick.example.protocol.FileOuterClass.File.Builder getFileBuilder() {
onChanged();
return getFileFieldBuilder().getBuilder();
}
/**
* .protocol.File file = 11;
*/
public com.redick.example.protocol.FileOuterClass.FileOrBuilder getFileOrBuilder() {
if (fileBuilder_ != null) {
return fileBuilder_.getMessageOrBuilder();
} else {
return file_ == null ?
com.redick.example.protocol.FileOuterClass.File.getDefaultInstance() : file_;
}
}
/**
* .protocol.File file = 11;
*/
private com.google.protobuf.SingleFieldBuilderV3<
com.redick.example.protocol.FileOuterClass.File, com.redick.example.protocol.FileOuterClass.File.Builder, com.redick.example.protocol.FileOuterClass.FileOrBuilder>
getFileFieldBuilder() {
if (fileBuilder_ == null) {
fileBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
com.redick.example.protocol.FileOuterClass.File, com.redick.example.protocol.FileOuterClass.File.Builder, com.redick.example.protocol.FileOuterClass.FileOrBuilder>(
getFile(),
getParentForChildren(),
isClean());
file_ = null;
}
return fileBuilder_;
}
private com.google.protobuf.MapField<
java.lang.String, java.lang.String> hobbys_;
private com.google.protobuf.MapField
internalGetHobbys() {
if (hobbys_ == null) {
return com.google.protobuf.MapField.emptyMapField(
HobbysDefaultEntryHolder.defaultEntry);
}
return hobbys_;
}
private com.google.protobuf.MapField
internalGetMutableHobbys() {
onChanged();;
if (hobbys_ == null) {
hobbys_ = com.google.protobuf.MapField.newMapField(
HobbysDefaultEntryHolder.defaultEntry);
}
if (!hobbys_.isMutable()) {
hobbys_ = hobbys_.copy();
}
return hobbys_;
}
public int getHobbysCount() {
return internalGetHobbys().getMap().size();
}
/**
* map<string, string> hobbys = 12;
*/
@java.lang.Override
public boolean containsHobbys(
java.lang.String key) {
if (key == null) { throw new NullPointerException("map key"); }
return internalGetHobbys().getMap().containsKey(key);
}
/**
* Use {@link #getHobbysMap()} instead.
*/
@java.lang.Override
@java.lang.Deprecated
public java.util.Map getHobbys() {
return getHobbysMap();
}
/**
* map<string, string> hobbys = 12;
*/
@java.lang.Override
public java.util.Map getHobbysMap() {
return internalGetHobbys().getMap();
}
/**
* map<string, string> hobbys = 12;
*/
@java.lang.Override
public java.lang.String getHobbysOrDefault(
java.lang.String key,
java.lang.String defaultValue) {
if (key == null) { throw new NullPointerException("map key"); }
java.util.Map map =
internalGetHobbys().getMap();
return map.containsKey(key) ? map.get(key) : defaultValue;
}
/**
* map<string, string> hobbys = 12;
*/
@java.lang.Override
public java.lang.String getHobbysOrThrow(
java.lang.String key) {
if (key == null) { throw new NullPointerException("map key"); }
java.util.Map map =
internalGetHobbys().getMap();
if (!map.containsKey(key)) {
throw new java.lang.IllegalArgumentException();
}
return map.get(key);
}
public Builder clearHobbys() {
internalGetMutableHobbys().getMutableMap()
.clear();
return this;
}
/**
* map<string, string> hobbys = 12;
*/
public Builder removeHobbys(
java.lang.String key) {
if (key == null) { throw new NullPointerException("map key"); }
internalGetMutableHobbys().getMutableMap()
.remove(key);
return this;
}
/**
* Use alternate mutation accessors instead.
*/
@java.lang.Deprecated
public java.util.Map
getMutableHobbys() {
return internalGetMutableHobbys().getMutableMap();
}
/**
* map<string, string> hobbys = 12;
*/
public Builder putHobbys(
java.lang.String key,
java.lang.String value) {
if (key == null) { throw new NullPointerException("map key"); }
if (value == null) {
throw new NullPointerException("map value");
}
internalGetMutableHobbys().getMutableMap()
.put(key, value);
return this;
}
/**
* map<string, string> hobbys = 12;
*/
public Builder putAllHobbys(
java.util.Map values) {
internalGetMutableHobbys().getMutableMap()
.putAll(values);
return this;
}
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:protocol.User)
}
// @@protoc_insertion_point(class_scope:protocol.User)
private static final com.redick.example.protocol.User DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new com.redick.example.protocol.User();
}
public static com.redick.example.protocol.User getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser
PARSER = new com.google.protobuf.AbstractParser() {
@java.lang.Override
public User parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new User(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser getParserForType() {
return PARSER;
}
@java.lang.Override
public com.redick.example.protocol.User getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy