@Test public void testHashCode() { RegistryConfig config1 = new RegistryConfig(); RegistryConfig config2 = new RegistryConfig(); config1.setAddress("127.0.0.1:1234").setProtocol("xxx"); config2.setAddress("127.0.0.1:1234").setProtocol("yyy"); Assert.assertFalse(config1.hashCode() == config2.hashCode()); config2.setProtocol("xxx"); Assert.assertTrue(config1.hashCode() == config2.hashCode()); }
@Override public int hashCode() { int result = protocol.hashCode(); result = 31 * result + (address != null ? address.hashCode() : 0); result = 31 * result + (index != null ? index.hashCode() : 0); result = 31 * result + (register ? 1 : 0); result = 31 * result + (subscribe ? 1 : 0); result = 31 * result + timeout; result = 31 * result + connectTimeout; result = 31 * result + (file != null ? file.hashCode() : 0); result = 31 * result + (batch ? 1 : 0); result = 31 * result + batchSize; result = 31 * result + heartbeatPeriod; result = 31 * result + reconnectPeriod; result = 31 * result + (parameters != null ? parameters.hashCode() : 0); return result; }
RegistryConfig extends AbstractIdConfig implements Serializable { @Override public int hashCode() { int result = protocol.hashCode(); result = 31 * result + (address != null ? address.hashCode() : 0); result = 31 * result + (index != null ? index.hashCode() : 0); result = 31 * result + (register ? 1 : 0); result = 31 * result + (subscribe ? 1 : 0); result = 31 * result + timeout; result = 31 * result + connectTimeout; result = 31 * result + (file != null ? file.hashCode() : 0); result = 31 * result + (batch ? 1 : 0); result = 31 * result + batchSize; result = 31 * result + heartbeatPeriod; result = 31 * result + reconnectPeriod; result = 31 * result + (parameters != null ? parameters.hashCode() : 0); return result; } }
RegistryConfig extends AbstractIdConfig implements Serializable { @Override public int hashCode() { int result = protocol.hashCode(); result = 31 * result + (address != null ? address.hashCode() : 0); result = 31 * result + (index != null ? index.hashCode() : 0); result = 31 * result + (register ? 1 : 0); result = 31 * result + (subscribe ? 1 : 0); result = 31 * result + timeout; result = 31 * result + connectTimeout; result = 31 * result + (file != null ? file.hashCode() : 0); result = 31 * result + (batch ? 1 : 0); result = 31 * result + batchSize; result = 31 * result + heartbeatPeriod; result = 31 * result + reconnectPeriod; result = 31 * result + (parameters != null ? parameters.hashCode() : 0); return result; }  }
RegistryConfig extends AbstractIdConfig implements Serializable { @Override public int hashCode() { int result = protocol.hashCode(); result = 31 * result + (address != null ? address.hashCode() : 0); result = 31 * result + (index != null ? index.hashCode() : 0); result = 31 * result + (register ? 1 : 0); result = 31 * result + (subscribe ? 1 : 0); result = 31 * result + timeout; result = 31 * result + connectTimeout; result = 31 * result + (file != null ? file.hashCode() : 0); result = 31 * result + (batch ? 1 : 0); result = 31 * result + batchSize; result = 31 * result + heartbeatPeriod; result = 31 * result + reconnectPeriod; result = 31 * result + (parameters != null ? parameters.hashCode() : 0); return result; }  String getProtocol(); RegistryConfig setProtocol(String protocol); String getAddress(); RegistryConfig setAddress(String address); String getIndex(); RegistryConfig setIndex(String index); boolean isRegister(); RegistryConfig setRegister(boolean register); boolean isSubscribe(); RegistryConfig setSubscribe(boolean subscribe); int getTimeout(); RegistryConfig setTimeout(int timeout); int getConnectTimeout(); RegistryConfig setConnectTimeout(int connectTimeout); String getFile(); RegistryConfig setFile(String file); boolean isBatch(); RegistryConfig setBatch(boolean batch); int getBatchSize(); RegistryConfig setBatchSize(int batchSize); int getHeartbeatPeriod(); RegistryConfig setHeartbeatPeriod(int heartbeatPeriod); int getReconnectPeriod(); RegistryConfig setReconnectPeriod(int reconnectPeriod); Map<String, String> getParameters(); RegistryConfig setParameters(Map<String, String> parameters); RegistryConfig setParameter(String key, String value); String getParameter(String key); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
RegistryConfig extends AbstractIdConfig implements Serializable { @Override public int hashCode() { int result = protocol.hashCode(); result = 31 * result + (address != null ? address.hashCode() : 0); result = 31 * result + (index != null ? index.hashCode() : 0); result = 31 * result + (register ? 1 : 0); result = 31 * result + (subscribe ? 1 : 0); result = 31 * result + timeout; result = 31 * result + connectTimeout; result = 31 * result + (file != null ? file.hashCode() : 0); result = 31 * result + (batch ? 1 : 0); result = 31 * result + batchSize; result = 31 * result + heartbeatPeriod; result = 31 * result + reconnectPeriod; result = 31 * result + (parameters != null ? parameters.hashCode() : 0); return result; }  String getProtocol(); RegistryConfig setProtocol(String protocol); String getAddress(); RegistryConfig setAddress(String address); String getIndex(); RegistryConfig setIndex(String index); boolean isRegister(); RegistryConfig setRegister(boolean register); boolean isSubscribe(); RegistryConfig setSubscribe(boolean subscribe); int getTimeout(); RegistryConfig setTimeout(int timeout); int getConnectTimeout(); RegistryConfig setConnectTimeout(int connectTimeout); String getFile(); RegistryConfig setFile(String file); boolean isBatch(); RegistryConfig setBatch(boolean batch); int getBatchSize(); RegistryConfig setBatchSize(int batchSize); int getHeartbeatPeriod(); RegistryConfig setHeartbeatPeriod(int heartbeatPeriod); int getReconnectPeriod(); RegistryConfig setReconnectPeriod(int reconnectPeriod); Map<String, String> getParameters(); RegistryConfig setParameters(Map<String, String> parameters); RegistryConfig setParameter(String key, String value); String getParameter(String key); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }