/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
// Generated by http://code.google.com/p/protostuff/ ... DO NOT EDIT!
// Generated from protobuf

package org.apache.drill.exec.proto.beans;

import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;

import com.dyuproject.protostuff.GraphIOUtil;
import com.dyuproject.protostuff.Input;
import com.dyuproject.protostuff.Message;
import com.dyuproject.protostuff.Output;
import com.dyuproject.protostuff.Schema;

public final class RpcEndpointInfos implements Externalizable, Message<RpcEndpointInfos>, Schema<RpcEndpointInfos>
{

    public static Schema<RpcEndpointInfos> getSchema()
    {
        return DEFAULT_INSTANCE;
    }

    public static RpcEndpointInfos getDefaultInstance()
    {
        return DEFAULT_INSTANCE;
    }

    static final RpcEndpointInfos DEFAULT_INSTANCE = new RpcEndpointInfos();

    
    private String name;
    private String version;
    private int majorVersion;
    private int minorVersion;
    private int patchVersion;
    private String application;
    private int buildNumber;
    private String versionQualifier;

    public RpcEndpointInfos()
    {
        
    }

    // getters and setters

    // name

    public String getName()
    {
        return name;
    }

    public RpcEndpointInfos setName(String name)
    {
        this.name = name;
        return this;
    }

    // version

    public String getVersion()
    {
        return version;
    }

    public RpcEndpointInfos setVersion(String version)
    {
        this.version = version;
        return this;
    }

    // majorVersion

    public int getMajorVersion()
    {
        return majorVersion;
    }

    public RpcEndpointInfos setMajorVersion(int majorVersion)
    {
        this.majorVersion = majorVersion;
        return this;
    }

    // minorVersion

    public int getMinorVersion()
    {
        return minorVersion;
    }

    public RpcEndpointInfos setMinorVersion(int minorVersion)
    {
        this.minorVersion = minorVersion;
        return this;
    }

    // patchVersion

    public int getPatchVersion()
    {
        return patchVersion;
    }

    public RpcEndpointInfos setPatchVersion(int patchVersion)
    {
        this.patchVersion = patchVersion;
        return this;
    }

    // application

    public String getApplication()
    {
        return application;
    }

    public RpcEndpointInfos setApplication(String application)
    {
        this.application = application;
        return this;
    }

    // buildNumber

    public int getBuildNumber()
    {
        return buildNumber;
    }

    public RpcEndpointInfos setBuildNumber(int buildNumber)
    {
        this.buildNumber = buildNumber;
        return this;
    }

    // versionQualifier

    public String getVersionQualifier()
    {
        return versionQualifier;
    }

    public RpcEndpointInfos setVersionQualifier(String versionQualifier)
    {
        this.versionQualifier = versionQualifier;
        return this;
    }

    // java serialization

    public void readExternal(ObjectInput in) throws IOException
    {
        GraphIOUtil.mergeDelimitedFrom(in, this, this);
    }

    public void writeExternal(ObjectOutput out) throws IOException
    {
        GraphIOUtil.writeDelimitedTo(out, this, this);
    }

    // message method

    public Schema<RpcEndpointInfos> cachedSchema()
    {
        return DEFAULT_INSTANCE;
    }

    // schema methods

    public RpcEndpointInfos newMessage()
    {
        return new RpcEndpointInfos();
    }

    public Class<RpcEndpointInfos> typeClass()
    {
        return RpcEndpointInfos.class;
    }

    public String messageName()
    {
        return RpcEndpointInfos.class.getSimpleName();
    }

    public String messageFullName()
    {
        return RpcEndpointInfos.class.getName();
    }

    public boolean isInitialized(RpcEndpointInfos message)
    {
        return true;
    }

    public void mergeFrom(Input input, RpcEndpointInfos message) throws IOException
    {
        for(int number = input.readFieldNumber(this);; number = input.readFieldNumber(this))
        {
            switch(number)
            {
                case 0:
                    return;
                case 1:
                    message.name = input.readString();
                    break;
                case 2:
                    message.version = input.readString();
                    break;
                case 3:
                    message.majorVersion = input.readUInt32();
                    break;
                case 4:
                    message.minorVersion = input.readUInt32();
                    break;
                case 5:
                    message.patchVersion = input.readUInt32();
                    break;
                case 6:
                    message.application = input.readString();
                    break;
                case 7:
                    message.buildNumber = input.readUInt32();
                    break;
                case 8:
                    message.versionQualifier = input.readString();
                    break;
                default:
                    input.handleUnknownField(number, this);
            }   
        }
    }


    public void writeTo(Output output, RpcEndpointInfos message) throws IOException
    {
        if(message.name != null)
            output.writeString(1, message.name, false);

        if(message.version != null)
            output.writeString(2, message.version, false);

        if(message.majorVersion != 0)
            output.writeUInt32(3, message.majorVersion, false);

        if(message.minorVersion != 0)
            output.writeUInt32(4, message.minorVersion, false);

        if(message.patchVersion != 0)
            output.writeUInt32(5, message.patchVersion, false);

        if(message.application != null)
            output.writeString(6, message.application, false);

        if(message.buildNumber != 0)
            output.writeUInt32(7, message.buildNumber, false);

        if(message.versionQualifier != null)
            output.writeString(8, message.versionQualifier, false);
    }

    public String getFieldName(int number)
    {
        switch(number)
        {
            case 1: return "name";
            case 2: return "version";
            case 3: return "majorVersion";
            case 4: return "minorVersion";
            case 5: return "patchVersion";
            case 6: return "application";
            case 7: return "buildNumber";
            case 8: return "versionQualifier";
            default: return null;
        }
    }

    public int getFieldNumber(String name)
    {
        final Integer number = __fieldMap.get(name);
        return number == null ? 0 : number.intValue();
    }

    private static final java.util.HashMap<String,Integer> __fieldMap = new java.util.HashMap<String,Integer>();
    static
    {
        __fieldMap.put("name", 1);
        __fieldMap.put("version", 2);
        __fieldMap.put("majorVersion", 3);
        __fieldMap.put("minorVersion", 4);
        __fieldMap.put("patchVersion", 5);
        __fieldMap.put("application", 6);
        __fieldMap.put("buildNumber", 7);
        __fieldMap.put("versionQualifier", 8);
    }
    
}
