// 
// Decompiled by Procyon v0.6.0
// 

package com.google.protobuf;

import java.io.InputStream;
import java.nio.ByteBuffer;
import java.io.IOException;

public final class Option extends GeneratedMessage implements OptionOrBuilder
{
    private static final long serialVersionUID = 0L;
    private int bitField0_;
    public static final int NAME_FIELD_NUMBER = 1;
    private volatile Object name_;
    public static final int VALUE_FIELD_NUMBER = 2;
    private Any value_;
    private byte memoizedIsInitialized;
    private static final Option DEFAULT_INSTANCE;
    private static final Parser<Option> PARSER;
    
    private Option(final GeneratedMessage.Builder<?> builder) {
        super(builder);
        this.name_ = "";
        this.memoizedIsInitialized = -1;
    }
    
    private Option() {
        this.name_ = "";
        this.memoizedIsInitialized = -1;
        this.name_ = "";
    }
    
    public static final Descriptors.Descriptor getDescriptor() {
        return TypeProto.internal_static_google_protobuf_Option_descriptor;
    }
    
    @Override
    protected FieldAccessorTable internalGetFieldAccessorTable() {
        return TypeProto.internal_static_google_protobuf_Option_fieldAccessorTable.ensureFieldAccessorsInitialized(Option.class, Builder.class);
    }
    
    @Override
    public String getName() {
        final Object ref = this.name_;
        if (ref instanceof String) {
            return (String)ref;
        }
        final ByteString bs = (ByteString)ref;
        final String s = bs.toStringUtf8();
        return (String)(this.name_ = s);
    }
    
    @Override
    public ByteString getNameBytes() {
        final Object ref = this.name_;
        if (ref instanceof String) {
            final ByteString b = ByteString.copyFromUtf8((String)ref);
            return (ByteString)(this.name_ = b);
        }
        return (ByteString)ref;
    }
    
    @Override
    public boolean hasValue() {
        return (this.bitField0_ & 0x1) != 0x0;
    }
    
    @Override
    public Any getValue() {
        return (this.value_ == null) ? Any.getDefaultInstance() : this.value_;
    }
    
    @Override
    public AnyOrBuilder getValueOrBuilder() {
        return (this.value_ == null) ? Any.getDefaultInstance() : this.value_;
    }
    
    @Override
    public final boolean isInitialized() {
        final byte isInitialized = this.memoizedIsInitialized;
        if (isInitialized == 1) {
            return true;
        }
        if (isInitialized == 0) {
            return false;
        }
        this.memoizedIsInitialized = 1;
        return true;
    }
    
    @Override
    public void writeTo(final CodedOutputStream output) throws IOException {
        if (!GeneratedMessage.isStringEmpty(this.name_)) {
            GeneratedMessage.writeString(output, 1, this.name_);
        }
        if ((this.bitField0_ & 0x1) != 0x0) {
            output.writeMessage(2, this.getValue());
        }
        this.getUnknownFields().writeTo(output);
    }
    
    @Override
    public int getSerializedSize() {
        int size = this.memoizedSize;
        if (size != -1) {
            return size;
        }
        size = 0;
        if (!GeneratedMessage.isStringEmpty(this.name_)) {
            size += GeneratedMessage.computeStringSize(1, this.name_);
        }
        if ((this.bitField0_ & 0x1) != 0x0) {
            size += CodedOutputStream.computeMessageSize(2, this.getValue());
        }
        size += this.getUnknownFields().getSerializedSize();
        return this.memoizedSize = size;
    }
    
    @Override
    public boolean equals(final Object obj) {
        if (obj == this) {
            return true;
        }
        if (!(obj instanceof Option)) {
            return super.equals(obj);
        }
        final Option other = (Option)obj;
        return this.getName().equals(other.getName()) && this.hasValue() == other.hasValue() && (!this.hasValue() || this.getValue().equals(other.getValue())) && this.getUnknownFields().equals(other.getUnknownFields());
    }
    
    @Override
    public int hashCode() {
        if (this.memoizedHashCode != 0) {
            return this.memoizedHashCode;
        }
        int hash = 41;
        hash = 19 * hash + getDescriptor().hashCode();
        hash = 37 * hash + 1;
        hash = 53 * hash + this.getName().hashCode();
        if (this.hasValue()) {
            hash = 37 * hash + 2;
            hash = 53 * hash + this.getValue().hashCode();
        }
        hash = 29 * hash + this.getUnknownFields().hashCode();
        return this.memoizedHashCode = hash;
    }
    
    public static Option parseFrom(final ByteBuffer data) throws InvalidProtocolBufferException {
        return Option.PARSER.parseFrom(data);
    }
    
    public static Option parseFrom(final ByteBuffer data, final ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException {
        return Option.PARSER.parseFrom(data, extensionRegistry);
    }
    
    public static Option parseFrom(final ByteString data) throws InvalidProtocolBufferException {
        return Option.PARSER.parseFrom(data);
    }
    
    public static Option parseFrom(final ByteString data, final ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException {
        return Option.PARSER.parseFrom(data, extensionRegistry);
    }
    
    public static Option parseFrom(final byte[] data) throws InvalidProtocolBufferException {
        return Option.PARSER.parseFrom(data);
    }
    
    public static Option parseFrom(final byte[] data, final ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException {
        return Option.PARSER.parseFrom(data, extensionRegistry);
    }
    
    public static Option parseFrom(final InputStream input) throws IOException {
        return GeneratedMessage.parseWithIOException(Option.PARSER, input);
    }
    
    public static Option parseFrom(final InputStream input, final ExtensionRegistryLite extensionRegistry) throws IOException {
        return GeneratedMessage.parseWithIOException(Option.PARSER, input, extensionRegistry);
    }
    
    public static Option parseDelimitedFrom(final InputStream input) throws IOException {
        return GeneratedMessage.parseDelimitedWithIOException(Option.PARSER, input);
    }
    
    public static Option parseDelimitedFrom(final InputStream input, final ExtensionRegistryLite extensionRegistry) throws IOException {
        return GeneratedMessage.parseDelimitedWithIOException(Option.PARSER, input, extensionRegistry);
    }
    
    public static Option parseFrom(final CodedInputStream input) throws IOException {
        return GeneratedMessage.parseWithIOException(Option.PARSER, input);
    }
    
    public static Option parseFrom(final CodedInputStream input, final ExtensionRegistryLite extensionRegistry) throws IOException {
        return GeneratedMessage.parseWithIOException(Option.PARSER, input, extensionRegistry);
    }
    
    @Override
    public Builder newBuilderForType() {
        return newBuilder();
    }
    
    public static Builder newBuilder() {
        return Option.DEFAULT_INSTANCE.toBuilder();
    }
    
    public static Builder newBuilder(final Option prototype) {
        return Option.DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
    }
    
    @Override
    public Builder toBuilder() {
        return (this == Option.DEFAULT_INSTANCE) ? new Builder() : new Builder().mergeFrom(this);
    }
    
    @Override
    protected Builder newBuilderForType(final BuilderParent parent) {
        final Builder builder = new Builder(parent);
        return builder;
    }
    
    public static Option getDefaultInstance() {
        return Option.DEFAULT_INSTANCE;
    }
    
    public static Parser<Option> parser() {
        return Option.PARSER;
    }
    
    @Override
    public Parser<Option> getParserForType() {
        return Option.PARSER;
    }
    
    @Override
    public Option getDefaultInstanceForType() {
        return Option.DEFAULT_INSTANCE;
    }
    
    static {
        RuntimeVersion.validateProtobufGencodeVersion(RuntimeVersion.RuntimeDomain.PUBLIC, 4, 33, 0, "", "Option");
        DEFAULT_INSTANCE = new Option();
        PARSER = new AbstractParser<Option>() {
            @Override
            public Option parsePartialFrom(final CodedInputStream input, final ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException {
                final Builder builder = Option.newBuilder();
                try {
                    builder.mergeFrom(input, extensionRegistry);
                }
                catch (final InvalidProtocolBufferException e) {
                    throw e.setUnfinishedMessage(builder.buildPartial());
                }
                catch (final UninitializedMessageException e2) {
                    throw e2.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
                }
                catch (final IOException e3) {
                    throw new InvalidProtocolBufferException(e3).setUnfinishedMessage(builder.buildPartial());
                }
                return builder.buildPartial();
            }
        };
    }
    
    public static final class Builder extends GeneratedMessage.Builder<Builder> implements OptionOrBuilder
    {
        private int bitField0_;
        private Object name_;
        private Any value_;
        private SingleFieldBuilder<Any, Any.Builder, AnyOrBuilder> valueBuilder_;
        
        public static final Descriptors.Descriptor getDescriptor() {
            return TypeProto.internal_static_google_protobuf_Option_descriptor;
        }
        
        @Override
        protected FieldAccessorTable internalGetFieldAccessorTable() {
            return TypeProto.internal_static_google_protobuf_Option_fieldAccessorTable.ensureFieldAccessorsInitialized(Option.class, Builder.class);
        }
        
        private Builder() {
            this.name_ = "";
            this.maybeForceBuilderInitialization();
        }
        
        private Builder(final BuilderParent parent) {
            super(parent);
            this.name_ = "";
            this.maybeForceBuilderInitialization();
        }
        
        private void maybeForceBuilderInitialization() {
            if (GeneratedMessage.alwaysUseFieldBuilders) {
                this.internalGetValueFieldBuilder();
            }
        }
        
        @Override
        public Builder clear() {
            super.clear();
            this.bitField0_ = 0;
            this.name_ = "";
            this.value_ = null;
            if (this.valueBuilder_ != null) {
                this.valueBuilder_.dispose();
                this.valueBuilder_ = null;
            }
            return this;
        }
        
        @Override
        public Descriptors.Descriptor getDescriptorForType() {
            return TypeProto.internal_static_google_protobuf_Option_descriptor;
        }
        
        @Override
        public Option getDefaultInstanceForType() {
            return Option.getDefaultInstance();
        }
        
        @Override
        public Option build() {
            final Option result = this.buildPartial();
            if (!result.isInitialized()) {
                throw AbstractMessage.Builder.newUninitializedMessageException(result);
            }
            return result;
        }
        
        @Override
        public Option buildPartial() {
            final Option result = new Option(this, null);
            if (this.bitField0_ != 0) {
                this.buildPartial0(result);
            }
            this.onBuilt();
            return result;
        }
        
        private void buildPartial0(final Option result) {
            final int from_bitField0_ = this.bitField0_;
            if ((from_bitField0_ & 0x1) != 0x0) {
                result.name_ = this.name_;
            }
            int to_bitField0_ = 0;
            if ((from_bitField0_ & 0x2) != 0x0) {
                result.value_ = ((this.valueBuilder_ == null) ? this.value_ : this.valueBuilder_.build());
                to_bitField0_ |= 0x1;
            }
            result.bitField0_ |= to_bitField0_;
        }
        
        @Override
        public Builder mergeFrom(final Message other) {
            if (other instanceof Option) {
                return this.mergeFrom((Option)other);
            }
            super.mergeFrom(other);
            return this;
        }
        
        public Builder mergeFrom(final Option other) {
            if (other == Option.getDefaultInstance()) {
                return this;
            }
            if (!other.getName().isEmpty()) {
                this.name_ = other.name_;
                this.bitField0_ |= 0x1;
                this.onChanged();
            }
            if (other.hasValue()) {
                this.mergeValue(other.getValue());
            }
            this.mergeUnknownFields(other.getUnknownFields());
            this.onChanged();
            return this;
        }
        
        @Override
        public final boolean isInitialized() {
            return true;
        }
        
        @Override
        public Builder mergeFrom(final CodedInputStream input, final ExtensionRegistryLite extensionRegistry) throws IOException {
            if (extensionRegistry == null) {
                throw new NullPointerException();
            }
            try {
                boolean done = false;
                while (!done) {
                    final int tag = input.readTag();
                    switch (tag) {
                        case 0: {
                            done = true;
                            continue;
                        }
                        case 10: {
                            this.name_ = input.readStringRequireUtf8();
                            this.bitField0_ |= 0x1;
                            continue;
                        }
                        case 18: {
                            input.readMessage(this.internalGetValueFieldBuilder().getBuilder(), extensionRegistry);
                            this.bitField0_ |= 0x2;
                            continue;
                        }
                        default: {
                            if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                                done = true;
                                continue;
                            }
                            continue;
                        }
                    }
                }
            }
            catch (final InvalidProtocolBufferException e) {
                throw e.unwrapIOException();
            }
            finally {
                this.onChanged();
            }
            return this;
        }
        
        @Override
        public String getName() {
            final Object ref = this.name_;
            if (!(ref instanceof String)) {
                final ByteString bs = (ByteString)ref;
                final String s = bs.toStringUtf8();
                return (String)(this.name_ = s);
            }
            return (String)ref;
        }
        
        @Override
        public ByteString getNameBytes() {
            final Object ref = this.name_;
            if (ref instanceof String) {
                final ByteString b = ByteString.copyFromUtf8((String)ref);
                return (ByteString)(this.name_ = b);
            }
            return (ByteString)ref;
        }
        
        public Builder setName(final String value) {
            if (value == null) {
                throw new NullPointerException();
            }
            this.name_ = value;
            this.bitField0_ |= 0x1;
            this.onChanged();
            return this;
        }
        
        public Builder clearName() {
            this.name_ = Option.getDefaultInstance().getName();
            this.bitField0_ &= 0xFFFFFFFE;
            this.onChanged();
            return this;
        }
        
        public Builder setNameBytes(final ByteString value) {
            if (value == null) {
                throw new NullPointerException();
            }
            AbstractMessageLite.checkByteStringIsUtf8(value);
            this.name_ = value;
            this.bitField0_ |= 0x1;
            this.onChanged();
            return this;
        }
        
        @Override
        public boolean hasValue() {
            return (this.bitField0_ & 0x2) != 0x0;
        }
        
        @Override
        public Any getValue() {
            if (this.valueBuilder_ == null) {
                return (this.value_ == null) ? Any.getDefaultInstance() : this.value_;
            }
            return this.valueBuilder_.getMessage();
        }
        
        public Builder setValue(final Any value) {
            if (this.valueBuilder_ == null) {
                if (value == null) {
                    throw new NullPointerException();
                }
                this.value_ = value;
            }
            else {
                this.valueBuilder_.setMessage(value);
            }
            this.bitField0_ |= 0x2;
            this.onChanged();
            return this;
        }
        
        public Builder setValue(final Any.Builder builderForValue) {
            if (this.valueBuilder_ == null) {
                this.value_ = builderForValue.build();
            }
            else {
                this.valueBuilder_.setMessage(builderForValue.build());
            }
            this.bitField0_ |= 0x2;
            this.onChanged();
            return this;
        }
        
        public Builder mergeValue(final Any value) {
            if (this.valueBuilder_ == null) {
                if ((this.bitField0_ & 0x2) != 0x0 && this.value_ != null && this.value_ != Any.getDefaultInstance()) {
                    this.getValueBuilder().mergeFrom(value);
                }
                else {
                    this.value_ = value;
                }
            }
            else {
                this.valueBuilder_.mergeFrom(value);
            }
            if (this.value_ != null) {
                this.bitField0_ |= 0x2;
                this.onChanged();
            }
            return this;
        }
        
        public Builder clearValue() {
            this.bitField0_ &= 0xFFFFFFFD;
            this.value_ = null;
            if (this.valueBuilder_ != null) {
                this.valueBuilder_.dispose();
                this.valueBuilder_ = null;
            }
            this.onChanged();
            return this;
        }
        
        public Any.Builder getValueBuilder() {
            this.bitField0_ |= 0x2;
            this.onChanged();
            return this.internalGetValueFieldBuilder().getBuilder();
        }
        
        @Override
        public AnyOrBuilder getValueOrBuilder() {
            if (this.valueBuilder_ != null) {
                return this.valueBuilder_.getMessageOrBuilder();
            }
            return (this.value_ == null) ? Any.getDefaultInstance() : this.value_;
        }
        
        private SingleFieldBuilder<Any, Any.Builder, AnyOrBuilder> internalGetValueFieldBuilder() {
            if (this.valueBuilder_ == null) {
                this.valueBuilder_ = new SingleFieldBuilder<Any, Any.Builder, AnyOrBuilder>(this.getValue(), this.getParentForChildren(), this.isClean());
                this.value_ = null;
            }
            return this.valueBuilder_;
        }
    }
}
