// Generated by the protocol buffer compiler. DO NOT EDIT! // source: com/google/protobuf/nested_builders_test.proto package protobuf_unittest; /** * Protobuf type {@code protobuf_unittest.Vehicle} */ public final class Vehicle extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:protobuf_unittest.Vehicle) VehicleOrBuilder { // Use Vehicle.newBuilder() to construct. private Vehicle(com.google.protobuf.GeneratedMessage.Builder<?> builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private Vehicle(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final Vehicle defaultInstance; public static Vehicle getDefaultInstance() { return defaultInstance; } public Vehicle getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private Vehicle( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); 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; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { protobuf_unittest.Engine.Builder subBuilder = null; if (((bitField0_ & 0x00000001) == 0x00000001)) { subBuilder = engine_.toBuilder(); } engine_ = input.readMessage(protobuf_unittest.Engine.PARSER, extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(engine_); engine_ = subBuilder.buildPartial(); } bitField0_ |= 0x00000001; break; } case 18: { if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { wheel_ = new java.util.ArrayList<protobuf_unittest.Wheel>(); mutable_bitField0_ |= 0x00000002; } wheel_.add(input.readMessage(protobuf_unittest.Wheel.PARSER, extensionRegistry)); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { wheel_ = java.util.Collections.unmodifiableList(wheel_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return protobuf_unittest.NestedBuilders.internal_static_protobuf_unittest_Vehicle_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return protobuf_unittest.NestedBuilders.internal_static_protobuf_unittest_Vehicle_fieldAccessorTable .ensureFieldAccessorsInitialized( protobuf_unittest.Vehicle.class, protobuf_unittest.Vehicle.Builder.class); } public static com.google.protobuf.Parser<Vehicle> PARSER = new com.google.protobuf.AbstractParser<Vehicle>() { public Vehicle parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new Vehicle(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser<Vehicle> getParserForType() { return PARSER; } private int bitField0_; public static final int ENGINE_FIELD_NUMBER = 1; private protobuf_unittest.Engine engine_; /** * <code>optional .protobuf_unittest.Engine engine = 1;</code> */ public boolean hasEngine() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * <code>optional .protobuf_unittest.Engine engine = 1;</code> */ public protobuf_unittest.Engine getEngine() { return engine_; } /** * <code>optional .protobuf_unittest.Engine engine = 1;</code> */ public protobuf_unittest.EngineOrBuilder getEngineOrBuilder() { return engine_; } public static final int WHEEL_FIELD_NUMBER = 2; private java.util.List<protobuf_unittest.Wheel> wheel_; /** * <code>repeated .protobuf_unittest.Wheel wheel = 2;</code> */ public java.util.List<protobuf_unittest.Wheel> getWheelList() { return wheel_; } /** * <code>repeated .protobuf_unittest.Wheel wheel = 2;</code> */ public java.util.List<? extends protobuf_unittest.WheelOrBuilder> getWheelOrBuilderList() { return wheel_; } /** * <code>repeated .protobuf_unittest.Wheel wheel = 2;</code> */ public int getWheelCount() { return wheel_.size(); } /** * <code>repeated .protobuf_unittest.Wheel wheel = 2;</code> */ public protobuf_unittest.Wheel getWheel(int index) { return wheel_.get(index); } /** * <code>repeated .protobuf_unittest.Wheel wheel = 2;</code> */ public protobuf_unittest.WheelOrBuilder getWheelOrBuilder( int index) { return wheel_.get(index); } private void initFields() { engine_ = protobuf_unittest.Engine.getDefaultInstance(); wheel_ = java.util.Collections.emptyList(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeMessage(1, engine_); } for (int i = 0; i < wheel_.size(); i++) { output.writeMessage(2, wheel_.get(i)); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, engine_); } for (int i = 0; i < wheel_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(2, wheel_.get(i)); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static protobuf_unittest.Vehicle parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static protobuf_unittest.Vehicle parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static protobuf_unittest.Vehicle parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static protobuf_unittest.Vehicle parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static protobuf_unittest.Vehicle parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static protobuf_unittest.Vehicle parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static protobuf_unittest.Vehicle parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static protobuf_unittest.Vehicle parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static protobuf_unittest.Vehicle parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static protobuf_unittest.Vehicle parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(protobuf_unittest.Vehicle prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code protobuf_unittest.Vehicle} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:protobuf_unittest.Vehicle) protobuf_unittest.VehicleOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return protobuf_unittest.NestedBuilders.internal_static_protobuf_unittest_Vehicle_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return protobuf_unittest.NestedBuilders.internal_static_protobuf_unittest_Vehicle_fieldAccessorTable .ensureFieldAccessorsInitialized( protobuf_unittest.Vehicle.class, protobuf_unittest.Vehicle.Builder.class); } // Construct using protobuf_unittest.Vehicle.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getEngineFieldBuilder(); getWheelFieldBuilder(); } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); if (engineBuilder_ == null) { engine_ = protobuf_unittest.Engine.getDefaultInstance(); } else { engineBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000001); if (wheelBuilder_ == null) { wheel_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000002); } else { wheelBuilder_.clear(); } return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return protobuf_unittest.NestedBuilders.internal_static_protobuf_unittest_Vehicle_descriptor; } public protobuf_unittest.Vehicle getDefaultInstanceForType() { return protobuf_unittest.Vehicle.getDefaultInstance(); } public protobuf_unittest.Vehicle build() { protobuf_unittest.Vehicle result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public protobuf_unittest.Vehicle buildPartial() { protobuf_unittest.Vehicle result = new protobuf_unittest.Vehicle(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } if (engineBuilder_ == null) { result.engine_ = engine_; } else { result.engine_ = engineBuilder_.build(); } if (wheelBuilder_ == null) { if (((bitField0_ & 0x00000002) == 0x00000002)) { wheel_ = java.util.Collections.unmodifiableList(wheel_); bitField0_ = (bitField0_ & ~0x00000002); } result.wheel_ = wheel_; } else { result.wheel_ = wheelBuilder_.build(); } result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof protobuf_unittest.Vehicle) { return mergeFrom((protobuf_unittest.Vehicle)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(protobuf_unittest.Vehicle other) { if (other == protobuf_unittest.Vehicle.getDefaultInstance()) return this; if (other.hasEngine()) { mergeEngine(other.getEngine()); } if (wheelBuilder_ == null) { if (!other.wheel_.isEmpty()) { if (wheel_.isEmpty()) { wheel_ = other.wheel_; bitField0_ = (bitField0_ & ~0x00000002); } else { ensureWheelIsMutable(); wheel_.addAll(other.wheel_); } onChanged(); } } else { if (!other.wheel_.isEmpty()) { if (wheelBuilder_.isEmpty()) { wheelBuilder_.dispose(); wheelBuilder_ = null; wheel_ = other.wheel_; bitField0_ = (bitField0_ & ~0x00000002); wheelBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getWheelFieldBuilder() : null; } else { wheelBuilder_.addAllMessages(other.wheel_); } } } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { protobuf_unittest.Vehicle parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (protobuf_unittest.Vehicle) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; private protobuf_unittest.Engine engine_ = protobuf_unittest.Engine.getDefaultInstance(); private com.google.protobuf.SingleFieldBuilder< protobuf_unittest.Engine, protobuf_unittest.Engine.Builder, protobuf_unittest.EngineOrBuilder> engineBuilder_; /** * <code>optional .protobuf_unittest.Engine engine = 1;</code> */ public boolean hasEngine() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * <code>optional .protobuf_unittest.Engine engine = 1;</code> */ public protobuf_unittest.Engine getEngine() { if (engineBuilder_ == null) { return engine_; } else { return engineBuilder_.getMessage(); } } /** * <code>optional .protobuf_unittest.Engine engine = 1;</code> */ public Builder setEngine(protobuf_unittest.Engine value) { if (engineBuilder_ == null) { if (value == null) { throw new NullPointerException(); } engine_ = value; onChanged(); } else { engineBuilder_.setMessage(value); } bitField0_ |= 0x00000001; return this; } /** * <code>optional .protobuf_unittest.Engine engine = 1;</code> */ public Builder setEngine( protobuf_unittest.Engine.Builder builderForValue) { if (engineBuilder_ == null) { engine_ = builderForValue.build(); onChanged(); } else { engineBuilder_.setMessage(builderForValue.build()); } bitField0_ |= 0x00000001; return this; } /** * <code>optional .protobuf_unittest.Engine engine = 1;</code> */ public Builder mergeEngine(protobuf_unittest.Engine value) { if (engineBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001) && engine_ != protobuf_unittest.Engine.getDefaultInstance()) { engine_ = protobuf_unittest.Engine.newBuilder(engine_).mergeFrom(value).buildPartial(); } else { engine_ = value; } onChanged(); } else { engineBuilder_.mergeFrom(value); } bitField0_ |= 0x00000001; return this; } /** * <code>optional .protobuf_unittest.Engine engine = 1;</code> */ public Builder clearEngine() { if (engineBuilder_ == null) { engine_ = protobuf_unittest.Engine.getDefaultInstance(); onChanged(); } else { engineBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000001); return this; } /** * <code>optional .protobuf_unittest.Engine engine = 1;</code> */ public protobuf_unittest.Engine.Builder getEngineBuilder() { bitField0_ |= 0x00000001; onChanged(); return getEngineFieldBuilder().getBuilder(); } /** * <code>optional .protobuf_unittest.Engine engine = 1;</code> */ public protobuf_unittest.EngineOrBuilder getEngineOrBuilder() { if (engineBuilder_ != null) { return engineBuilder_.getMessageOrBuilder(); } else { return engine_; } } /** * <code>optional .protobuf_unittest.Engine engine = 1;</code> */ private com.google.protobuf.SingleFieldBuilder< protobuf_unittest.Engine, protobuf_unittest.Engine.Builder, protobuf_unittest.EngineOrBuilder> getEngineFieldBuilder() { if (engineBuilder_ == null) { engineBuilder_ = new com.google.protobuf.SingleFieldBuilder< protobuf_unittest.Engine, protobuf_unittest.Engine.Builder, protobuf_unittest.EngineOrBuilder>( getEngine(), getParentForChildren(), isClean()); engine_ = null; } return engineBuilder_; } private java.util.List<protobuf_unittest.Wheel> wheel_ = java.util.Collections.emptyList(); private void ensureWheelIsMutable() { if (!((bitField0_ & 0x00000002) == 0x00000002)) { wheel_ = new java.util.ArrayList<protobuf_unittest.Wheel>(wheel_); bitField0_ |= 0x00000002; } } private com.google.protobuf.RepeatedFieldBuilder< protobuf_unittest.Wheel, protobuf_unittest.Wheel.Builder, protobuf_unittest.WheelOrBuilder> wheelBuilder_; /** * <code>repeated .protobuf_unittest.Wheel wheel = 2;</code> */ public java.util.List<protobuf_unittest.Wheel> getWheelList() { if (wheelBuilder_ == null) { return java.util.Collections.unmodifiableList(wheel_); } else { return wheelBuilder_.getMessageList(); } } /** * <code>repeated .protobuf_unittest.Wheel wheel = 2;</code> */ public int getWheelCount() { if (wheelBuilder_ == null) { return wheel_.size(); } else { return wheelBuilder_.getCount(); } } /** * <code>repeated .protobuf_unittest.Wheel wheel = 2;</code> */ public protobuf_unittest.Wheel getWheel(int index) { if (wheelBuilder_ == null) { return wheel_.get(index); } else { return wheelBuilder_.getMessage(index); } } /** * <code>repeated .protobuf_unittest.Wheel wheel = 2;</code> */ public Builder setWheel( int index, protobuf_unittest.Wheel value) { if (wheelBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureWheelIsMutable(); wheel_.set(index, value); onChanged(); } else { wheelBuilder_.setMessage(index, value); } return this; } /** * <code>repeated .protobuf_unittest.Wheel wheel = 2;</code> */ public Builder setWheel( int index, protobuf_unittest.Wheel.Builder builderForValue) { if (wheelBuilder_ == null) { ensureWheelIsMutable(); wheel_.set(index, builderForValue.build()); onChanged(); } else { wheelBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * <code>repeated .protobuf_unittest.Wheel wheel = 2;</code> */ public Builder addWheel(protobuf_unittest.Wheel value) { if (wheelBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureWheelIsMutable(); wheel_.add(value); onChanged(); } else { wheelBuilder_.addMessage(value); } return this; } /** * <code>repeated .protobuf_unittest.Wheel wheel = 2;</code> */ public Builder addWheel( int index, protobuf_unittest.Wheel value) { if (wheelBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureWheelIsMutable(); wheel_.add(index, value); onChanged(); } else { wheelBuilder_.addMessage(index, value); } return this; } /** * <code>repeated .protobuf_unittest.Wheel wheel = 2;</code> */ public Builder addWheel( protobuf_unittest.Wheel.Builder builderForValue) { if (wheelBuilder_ == null) { ensureWheelIsMutable(); wheel_.add(builderForValue.build()); onChanged(); } else { wheelBuilder_.addMessage(builderForValue.build()); } return this; } /** * <code>repeated .protobuf_unittest.Wheel wheel = 2;</code> */ public Builder addWheel( int index, protobuf_unittest.Wheel.Builder builderForValue) { if (wheelBuilder_ == null) { ensureWheelIsMutable(); wheel_.add(index, builderForValue.build()); onChanged(); } else { wheelBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * <code>repeated .protobuf_unittest.Wheel wheel = 2;</code> */ public Builder addAllWheel( java.lang.Iterable<? extends protobuf_unittest.Wheel> values) { if (wheelBuilder_ == null) { ensureWheelIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll( values, wheel_); onChanged(); } else { wheelBuilder_.addAllMessages(values); } return this; } /** * <code>repeated .protobuf_unittest.Wheel wheel = 2;</code> */ public Builder clearWheel() { if (wheelBuilder_ == null) { wheel_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000002); onChanged(); } else { wheelBuilder_.clear(); } return this; } /** * <code>repeated .protobuf_unittest.Wheel wheel = 2;</code> */ public Builder removeWheel(int index) { if (wheelBuilder_ == null) { ensureWheelIsMutable(); wheel_.remove(index); onChanged(); } else { wheelBuilder_.remove(index); } return this; } /** * <code>repeated .protobuf_unittest.Wheel wheel = 2;</code> */ public protobuf_unittest.Wheel.Builder getWheelBuilder( int index) { return getWheelFieldBuilder().getBuilder(index); } /** * <code>repeated .protobuf_unittest.Wheel wheel = 2;</code> */ public protobuf_unittest.WheelOrBuilder getWheelOrBuilder( int index) { if (wheelBuilder_ == null) { return wheel_.get(index); } else { return wheelBuilder_.getMessageOrBuilder(index); } } /** * <code>repeated .protobuf_unittest.Wheel wheel = 2;</code> */ public java.util.List<? extends protobuf_unittest.WheelOrBuilder> getWheelOrBuilderList() { if (wheelBuilder_ != null) { return wheelBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(wheel_); } } /** * <code>repeated .protobuf_unittest.Wheel wheel = 2;</code> */ public protobuf_unittest.Wheel.Builder addWheelBuilder() { return getWheelFieldBuilder().addBuilder( protobuf_unittest.Wheel.getDefaultInstance()); } /** * <code>repeated .protobuf_unittest.Wheel wheel = 2;</code> */ public protobuf_unittest.Wheel.Builder addWheelBuilder( int index) { return getWheelFieldBuilder().addBuilder( index, protobuf_unittest.Wheel.getDefaultInstance()); } /** * <code>repeated .protobuf_unittest.Wheel wheel = 2;</code> */ public java.util.List<protobuf_unittest.Wheel.Builder> getWheelBuilderList() { return getWheelFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilder< protobuf_unittest.Wheel, protobuf_unittest.Wheel.Builder, protobuf_unittest.WheelOrBuilder> getWheelFieldBuilder() { if (wheelBuilder_ == null) { wheelBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< protobuf_unittest.Wheel, protobuf_unittest.Wheel.Builder, protobuf_unittest.WheelOrBuilder>( wheel_, ((bitField0_ & 0x00000002) == 0x00000002), getParentForChildren(), isClean()); wheel_ = null; } return wheelBuilder_; } // @@protoc_insertion_point(builder_scope:protobuf_unittest.Vehicle) } static { defaultInstance = new Vehicle(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:protobuf_unittest.Vehicle) }