All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.dongliu.prettypb.rpc.protocol.ServerInfo Maven / Gradle / Ivy

There is a newer version: 0.3.5
Show newest version
//Generated by pretty java compiler, DO NOT MODIFY!
package net.dongliu.prettypb.rpc.protocol;
import net.dongliu.prettypb.runtime.include.*;

@ProtoBean(name = "ServerInfo", protoPackage = "")
public class ServerInfo {
    
    @ProtoField(idx=1, type=ProtoType.String, name="host", required=true)
    private String host;
    
    @ProtoField(idx=2, type=ProtoType.UInt32, name="port", required=true)
    private int port;
    
    @ProtoField(idx=3, type=ProtoType.UInt32, name="weight")
    private int weight;
    
    private boolean _host;
    private boolean _port;
    private boolean _weight;
    
    public String getHost () {
        return host;
    }
    
    public void setHost (String host) {
        if (!this._host) this._host = true;
        this.host = host;
    }
    
    public int getPort () {
        return port;
    }
    
    public void setPort (int port) {
        if (!this._port) this._port = true;
        this.port = port;
    }
    
    public int getWeight () {
        return weight;
    }
    
    public void setWeight (int weight) {
        if (!this._weight) this._weight = true;
        this.weight = weight;
    }
    
    public boolean hasHost () {
        return _host && host != null;
    }
    
    public boolean hasPort () {
        return _port;
    }
    
    public boolean hasWeight () {
        return _weight;
    }
    
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder("ServerInfo{\n");
        if (_host)
            sb.append("host: ").append(host).append("\n");
        if (_port)
            sb.append("port: ").append(port).append("\n");
        if (_weight)
            sb.append("weight: ").append(weight).append("\n");
        sb.append("}");
        return sb.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy