com.freemanan.sample.pet.v1.Pet Maven / Gradle / Ivy
The newest version!
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: sample/pet/v1/pet.proto
// Protobuf Java Version: 3.25.1
package com.freemanan.sample.pet.v1;
/**
* Protobuf type {@code sample.pet.v1.Pet}
*/
public final class Pet extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:sample.pet.v1.Pet)
PetOrBuilder {
private static final long serialVersionUID = 0L;
// Use Pet.newBuilder() to construct.
private Pet(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
super(builder);
}
private Pet() {
name_ = "";
favoriteFoods_ =
com.google.protobuf.LazyStringArrayList.emptyList();
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new Pet();
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.freemanan.sample.pet.v1.PetOuterClass.internal_static_sample_pet_v1_Pet_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.freemanan.sample.pet.v1.PetOuterClass.internal_static_sample_pet_v1_Pet_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.freemanan.sample.pet.v1.Pet.class, com.freemanan.sample.pet.v1.Pet.Builder.class);
}
public static final int NAME_FIELD_NUMBER = 1;
@SuppressWarnings("serial")
private volatile java.lang.Object name_ = "";
/**
* string name = 1;
* @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 = 1;
* @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 AGE_FIELD_NUMBER = 2;
private int age_ = 0;
/**
* int32 age = 2;
* @return The age.
*/
@java.lang.Override
public int getAge() {
return age_;
}
public static final int FAVORITE_FOODS_FIELD_NUMBER = 3;
@SuppressWarnings("serial")
private com.google.protobuf.LazyStringArrayList favoriteFoods_ =
com.google.protobuf.LazyStringArrayList.emptyList();
/**
* repeated string favorite_foods = 3;
* @return A list containing the favoriteFoods.
*/
public com.google.protobuf.ProtocolStringList
getFavoriteFoodsList() {
return favoriteFoods_;
}
/**
* repeated string favorite_foods = 3;
* @return The count of favoriteFoods.
*/
public int getFavoriteFoodsCount() {
return favoriteFoods_.size();
}
/**
* repeated string favorite_foods = 3;
* @param index The index of the element to return.
* @return The favoriteFoods at the given index.
*/
public java.lang.String getFavoriteFoods(int index) {
return favoriteFoods_.get(index);
}
/**
* repeated string favorite_foods = 3;
* @param index The index of the value to return.
* @return The bytes of the favoriteFoods at the given index.
*/
public com.google.protobuf.ByteString
getFavoriteFoodsBytes(int index) {
return favoriteFoods_.getByteString(index);
}
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 {
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_);
}
if (age_ != 0) {
output.writeInt32(2, age_);
}
for (int i = 0; i < favoriteFoods_.size(); i++) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 3, favoriteFoods_.getRaw(i));
}
getUnknownFields().writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_);
}
if (age_ != 0) {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(2, age_);
}
{
int dataSize = 0;
for (int i = 0; i < favoriteFoods_.size(); i++) {
dataSize += computeStringSizeNoTag(favoriteFoods_.getRaw(i));
}
size += dataSize;
size += 1 * getFavoriteFoodsList().size();
}
size += getUnknownFields().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.freemanan.sample.pet.v1.Pet)) {
return super.equals(obj);
}
com.freemanan.sample.pet.v1.Pet other = (com.freemanan.sample.pet.v1.Pet) obj;
if (!getName()
.equals(other.getName())) return false;
if (getAge()
!= other.getAge()) return false;
if (!getFavoriteFoodsList()
.equals(other.getFavoriteFoodsList())) return false;
if (!getUnknownFields().equals(other.getUnknownFields())) 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) + NAME_FIELD_NUMBER;
hash = (53 * hash) + getName().hashCode();
hash = (37 * hash) + AGE_FIELD_NUMBER;
hash = (53 * hash) + getAge();
if (getFavoriteFoodsCount() > 0) {
hash = (37 * hash) + FAVORITE_FOODS_FIELD_NUMBER;
hash = (53 * hash) + getFavoriteFoodsList().hashCode();
}
hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
}
public static com.freemanan.sample.pet.v1.Pet parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.freemanan.sample.pet.v1.Pet parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.freemanan.sample.pet.v1.Pet parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.freemanan.sample.pet.v1.Pet parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.freemanan.sample.pet.v1.Pet parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.freemanan.sample.pet.v1.Pet parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.freemanan.sample.pet.v1.Pet parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static com.freemanan.sample.pet.v1.Pet 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.freemanan.sample.pet.v1.Pet parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static com.freemanan.sample.pet.v1.Pet 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.freemanan.sample.pet.v1.Pet parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static com.freemanan.sample.pet.v1.Pet 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.freemanan.sample.pet.v1.Pet 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 sample.pet.v1.Pet}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder implements
// @@protoc_insertion_point(builder_implements:sample.pet.v1.Pet)
com.freemanan.sample.pet.v1.PetOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.freemanan.sample.pet.v1.PetOuterClass.internal_static_sample_pet_v1_Pet_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.freemanan.sample.pet.v1.PetOuterClass.internal_static_sample_pet_v1_Pet_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.freemanan.sample.pet.v1.Pet.class, com.freemanan.sample.pet.v1.Pet.Builder.class);
}
// Construct using com.freemanan.sample.pet.v1.Pet.newBuilder()
private Builder() {
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
}
@java.lang.Override
public Builder clear() {
super.clear();
bitField0_ = 0;
name_ = "";
age_ = 0;
favoriteFoods_ =
com.google.protobuf.LazyStringArrayList.emptyList();
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.freemanan.sample.pet.v1.PetOuterClass.internal_static_sample_pet_v1_Pet_descriptor;
}
@java.lang.Override
public com.freemanan.sample.pet.v1.Pet getDefaultInstanceForType() {
return com.freemanan.sample.pet.v1.Pet.getDefaultInstance();
}
@java.lang.Override
public com.freemanan.sample.pet.v1.Pet build() {
com.freemanan.sample.pet.v1.Pet result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public com.freemanan.sample.pet.v1.Pet buildPartial() {
com.freemanan.sample.pet.v1.Pet result = new com.freemanan.sample.pet.v1.Pet(this);
if (bitField0_ != 0) { buildPartial0(result); }
onBuilt();
return result;
}
private void buildPartial0(com.freemanan.sample.pet.v1.Pet result) {
int from_bitField0_ = bitField0_;
if (((from_bitField0_ & 0x00000001) != 0)) {
result.name_ = name_;
}
if (((from_bitField0_ & 0x00000002) != 0)) {
result.age_ = age_;
}
if (((from_bitField0_ & 0x00000004) != 0)) {
favoriteFoods_.makeImmutable();
result.favoriteFoods_ = favoriteFoods_;
}
}
@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.freemanan.sample.pet.v1.Pet) {
return mergeFrom((com.freemanan.sample.pet.v1.Pet)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.freemanan.sample.pet.v1.Pet other) {
if (other == com.freemanan.sample.pet.v1.Pet.getDefaultInstance()) return this;
if (!other.getName().isEmpty()) {
name_ = other.name_;
bitField0_ |= 0x00000001;
onChanged();
}
if (other.getAge() != 0) {
setAge(other.getAge());
}
if (!other.favoriteFoods_.isEmpty()) {
if (favoriteFoods_.isEmpty()) {
favoriteFoods_ = other.favoriteFoods_;
bitField0_ |= 0x00000004;
} else {
ensureFavoriteFoodsIsMutable();
favoriteFoods_.addAll(other.favoriteFoods_);
}
onChanged();
}
this.mergeUnknownFields(other.getUnknownFields());
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 {
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 10: {
name_ = input.readStringRequireUtf8();
bitField0_ |= 0x00000001;
break;
} // case 10
case 16: {
age_ = input.readInt32();
bitField0_ |= 0x00000002;
break;
} // case 16
case 26: {
java.lang.String s = input.readStringRequireUtf8();
ensureFavoriteFoodsIsMutable();
favoriteFoods_.add(s);
break;
} // case 26
default: {
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
done = true; // was an endgroup tag
}
break;
} // default:
} // switch (tag)
} // while (!done)
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.unwrapIOException();
} finally {
onChanged();
} // finally
return this;
}
private int bitField0_;
private java.lang.Object name_ = "";
/**
* string name = 1;
* @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 = 1;
* @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 = 1;
* @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;
bitField0_ |= 0x00000001;
onChanged();
return this;
}
/**
* string name = 1;
* @return This builder for chaining.
*/
public Builder clearName() {
name_ = getDefaultInstance().getName();
bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
return this;
}
/**
* string name = 1;
* @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;
bitField0_ |= 0x00000001;
onChanged();
return this;
}
private int age_ ;
/**
* int32 age = 2;
* @return The age.
*/
@java.lang.Override
public int getAge() {
return age_;
}
/**
* int32 age = 2;
* @param value The age to set.
* @return This builder for chaining.
*/
public Builder setAge(int value) {
age_ = value;
bitField0_ |= 0x00000002;
onChanged();
return this;
}
/**
* int32 age = 2;
* @return This builder for chaining.
*/
public Builder clearAge() {
bitField0_ = (bitField0_ & ~0x00000002);
age_ = 0;
onChanged();
return this;
}
private com.google.protobuf.LazyStringArrayList favoriteFoods_ =
com.google.protobuf.LazyStringArrayList.emptyList();
private void ensureFavoriteFoodsIsMutable() {
if (!favoriteFoods_.isModifiable()) {
favoriteFoods_ = new com.google.protobuf.LazyStringArrayList(favoriteFoods_);
}
bitField0_ |= 0x00000004;
}
/**
* repeated string favorite_foods = 3;
* @return A list containing the favoriteFoods.
*/
public com.google.protobuf.ProtocolStringList
getFavoriteFoodsList() {
favoriteFoods_.makeImmutable();
return favoriteFoods_;
}
/**
* repeated string favorite_foods = 3;
* @return The count of favoriteFoods.
*/
public int getFavoriteFoodsCount() {
return favoriteFoods_.size();
}
/**
* repeated string favorite_foods = 3;
* @param index The index of the element to return.
* @return The favoriteFoods at the given index.
*/
public java.lang.String getFavoriteFoods(int index) {
return favoriteFoods_.get(index);
}
/**
* repeated string favorite_foods = 3;
* @param index The index of the value to return.
* @return The bytes of the favoriteFoods at the given index.
*/
public com.google.protobuf.ByteString
getFavoriteFoodsBytes(int index) {
return favoriteFoods_.getByteString(index);
}
/**
* repeated string favorite_foods = 3;
* @param index The index to set the value at.
* @param value The favoriteFoods to set.
* @return This builder for chaining.
*/
public Builder setFavoriteFoods(
int index, java.lang.String value) {
if (value == null) { throw new NullPointerException(); }
ensureFavoriteFoodsIsMutable();
favoriteFoods_.set(index, value);
bitField0_ |= 0x00000004;
onChanged();
return this;
}
/**
* repeated string favorite_foods = 3;
* @param value The favoriteFoods to add.
* @return This builder for chaining.
*/
public Builder addFavoriteFoods(
java.lang.String value) {
if (value == null) { throw new NullPointerException(); }
ensureFavoriteFoodsIsMutable();
favoriteFoods_.add(value);
bitField0_ |= 0x00000004;
onChanged();
return this;
}
/**
* repeated string favorite_foods = 3;
* @param values The favoriteFoods to add.
* @return This builder for chaining.
*/
public Builder addAllFavoriteFoods(
java.lang.Iterable values) {
ensureFavoriteFoodsIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, favoriteFoods_);
bitField0_ |= 0x00000004;
onChanged();
return this;
}
/**
* repeated string favorite_foods = 3;
* @return This builder for chaining.
*/
public Builder clearFavoriteFoods() {
favoriteFoods_ =
com.google.protobuf.LazyStringArrayList.emptyList();
bitField0_ = (bitField0_ & ~0x00000004);;
onChanged();
return this;
}
/**
* repeated string favorite_foods = 3;
* @param value The bytes of the favoriteFoods to add.
* @return This builder for chaining.
*/
public Builder addFavoriteFoodsBytes(
com.google.protobuf.ByteString value) {
if (value == null) { throw new NullPointerException(); }
checkByteStringIsUtf8(value);
ensureFavoriteFoodsIsMutable();
favoriteFoods_.add(value);
bitField0_ |= 0x00000004;
onChanged();
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:sample.pet.v1.Pet)
}
// @@protoc_insertion_point(class_scope:sample.pet.v1.Pet)
private static final com.freemanan.sample.pet.v1.Pet DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new com.freemanan.sample.pet.v1.Pet();
}
public static com.freemanan.sample.pet.v1.Pet getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser
PARSER = new com.google.protobuf.AbstractParser() {
@java.lang.Override
public Pet parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
Builder builder = newBuilder();
try {
builder.mergeFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(builder.buildPartial());
} catch (com.google.protobuf.UninitializedMessageException e) {
throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(e)
.setUnfinishedMessage(builder.buildPartial());
}
return builder.buildPartial();
}
};
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.freemanan.sample.pet.v1.Pet getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}