001/** 002 * Copyright (c) 2015-2022, Michael Yang 杨福海 (fuhai999@gmail.com). 003 * <p> 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * <p> 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * <p> 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package io.jboot.components.rpc; 017 018import java.io.Serializable; 019import java.util.Objects; 020 021/** 022 * @author Michael Yang 杨福海 (fuhai999@gmail.com) 023 * @version V1.0 024 */ 025public class JbootrpcReferenceConfig implements Serializable { 026 027 /** 028 * Service version, default value is empty string 029 */ 030 private String version; 031 032 /** 033 * Service group, default value is empty string 034 */ 035 private String group; 036 037 /** 038 * Service target URL for direct invocation, if this is specified, then registry center takes no effect. 039 */ 040 private String url; 041 042 043 /** 044 * Whether to enable generic invocation, default value is false 045 */ 046 private Boolean generic; 047 048 049 /** 050 * Check if service provider is available during boot up, default value is true 051 */ 052 private Boolean check; 053 054 055 /** 056 * Service invocation retry times 057 * <p> 058 * see Constants#DEFAULT_RETRIES 059 */ 060 private Integer retries; 061 062 063 /** 064 * Load balance strategy, legal values include: random, roundrobin, leastactive 065 * <p> 066 * see Constants#DEFAULT_LOADBALANCE 067 */ 068 private String loadbalance; 069 070 /** 071 * Whether to enable async invocation, default value is false 072 */ 073 private Boolean async; 074 075 /** 076 * Maximum active requests allowed, default value is 0 077 */ 078 private Integer actives; 079 080 081 /** 082 * Timeout value for service invocation, default value is 0 083 */ 084 private Integer timeout; 085 086 /** 087 * Application associated name 088 */ 089 private String application; 090 091 /** 092 * Module associated name 093 */ 094 private String module; 095 096 097 /** 098 * Consumer associated name 099 */ 100 private String consumer; 101 102 /** 103 * Monitor associated name 104 */ 105 private String monitor; 106 107 /** 108 * Registry associated name 109 */ 110 private String registry; 111 112 /** 113 * the default value is "" 114 */ 115 private String protocol; 116 117 /** 118 * Service tag name 119 */ 120 private String tag; 121 122 /** 123 * The id 124 * <p> 125 * default value is empty 126 */ 127 private String id; 128 129 130 public JbootrpcReferenceConfig() { 131 } 132 133 public String getVersion() { 134 return version; 135 } 136 137 public void setVersion(String version) { 138 this.version = version; 139 } 140 141 public String getGroup() { 142 return group; 143 } 144 145 public void setGroup(String group) { 146 this.group = group; 147 } 148 149 public String getUrl() { 150 return url; 151 } 152 153 public void setUrl(String url) { 154 this.url = url; 155 } 156 157 public boolean isGeneric() { 158 return generic; 159 } 160 161 public void setGeneric(boolean generic) { 162 this.generic = generic; 163 } 164 165 public boolean isCheck() { 166 return check; 167 } 168 169 public void setCheck(boolean check) { 170 this.check = check; 171 } 172 173 public int getRetries() { 174 return retries; 175 } 176 177 public void setRetries(int retries) { 178 this.retries = retries; 179 } 180 181 public String getLoadbalance() { 182 return loadbalance; 183 } 184 185 public void setLoadbalance(String loadbalance) { 186 this.loadbalance = loadbalance; 187 } 188 189 public boolean isAsync() { 190 return async; 191 } 192 193 public void setAsync(boolean async) { 194 this.async = async; 195 } 196 197 public int getActives() { 198 return actives; 199 } 200 201 public void setActives(int actives) { 202 this.actives = actives; 203 } 204 205 public int getTimeout() { 206 return timeout; 207 } 208 209 public void setTimeout(int timeout) { 210 this.timeout = timeout; 211 } 212 213 public String getApplication() { 214 return application; 215 } 216 217 public void setApplication(String application) { 218 this.application = application; 219 } 220 221 public String getModule() { 222 return module; 223 } 224 225 public void setModule(String module) { 226 this.module = module; 227 } 228 229 public String getConsumer() { 230 return consumer; 231 } 232 233 public void setConsumer(String consumer) { 234 this.consumer = consumer; 235 } 236 237 public String getMonitor() { 238 return monitor; 239 } 240 241 public void setMonitor(String monitor) { 242 this.monitor = monitor; 243 } 244 245 public String getRegistry() { 246 return registry; 247 } 248 249 public void setRegistry(String registry) { 250 this.registry = registry; 251 } 252 253 public String getProtocol() { 254 return protocol; 255 } 256 257 public void setProtocol(String protocol) { 258 this.protocol = protocol; 259 } 260 261 public String getTag() { 262 return tag; 263 } 264 265 public void setTag(String tag) { 266 this.tag = tag; 267 } 268 269 public String getId() { 270 return id; 271 } 272 273 public void setId(String id) { 274 this.id = id; 275 } 276 277 @Override 278 public boolean equals(Object o) { 279 if (this == o) { 280 return true; 281 } 282 if (o == null || getClass() != o.getClass()) { 283 return false; 284 } 285 JbootrpcReferenceConfig that = (JbootrpcReferenceConfig) o; 286 return Objects.equals(version, that.version) && Objects.equals(group, that.group) && Objects.equals(url, that.url) && Objects.equals(generic, that.generic) && Objects.equals(check, that.check) && Objects.equals(retries, that.retries) && Objects.equals(loadbalance, that.loadbalance) && Objects.equals(async, that.async) && Objects.equals(actives, that.actives) && Objects.equals(timeout, that.timeout) && Objects.equals(application, that.application) && Objects.equals(module, that.module) && Objects.equals(consumer, that.consumer) && Objects.equals(monitor, that.monitor) && Objects.equals(registry, that.registry) && Objects.equals(protocol, that.protocol) && Objects.equals(tag, that.tag) && Objects.equals(id, that.id); 287 } 288 289 @Override 290 public int hashCode() { 291 return Objects.hash(version, group, url, generic, check, retries, loadbalance, async, actives, timeout, application, module, consumer, monitor, registry, protocol, tag, id); 292 } 293}