1- namespace Kafka . Client . Common
2- {
3- /// <summary>
4- /// Convenience case class since (clientId, brokerInfo) pairs are used to create
5- /// SyncProducer Request Stats and SimpleConsumer Request and Response Stats.
6- /// </summary>
7- public class ClientIdAndBroker
8- {
9- public string ClientId { get ; private set ; }
10-
11- public string BrokerInfo { get ; private set ; }
12-
13- public ClientIdAndBroker ( string clientId , string brokerInfo )
14- {
15- this . ClientId = clientId ;
16- this . BrokerInfo = brokerInfo ;
17- }
18-
19- public override string ToString ( )
20- {
21- return string . Format ( "{0}-{1}" , this . ClientId , this . BrokerInfo ) ;
22- }
23- }
1+ namespace Kafka . Client . Common
2+ {
3+ /// <summary>
4+ /// Convenience case class since (clientId, brokerInfo) pairs are used to create
5+ /// SyncProducer Request Stats and SimpleConsumer Request and Response Stats.
6+ /// </summary>
7+ public class ClientIdAndBroker
8+ {
9+ public string ClientId { get ; private set ; }
10+
11+ public string BrokerInfo { get ; private set ; }
12+
13+ public ClientIdAndBroker ( string clientId , string brokerInfo )
14+ {
15+ this . ClientId = clientId ;
16+ this . BrokerInfo = brokerInfo ;
17+ }
18+
19+ public override string ToString ( )
20+ {
21+ return string . Format ( "{0}-{1}" , this . ClientId , this . BrokerInfo ) ;
22+ }
23+
24+ protected bool Equals ( ClientIdAndBroker other )
25+ {
26+ return this . ClientId == other . ClientId && this . BrokerInfo == other . BrokerInfo ;
27+ }
28+
29+ public override bool Equals ( object obj )
30+ {
31+ if ( ReferenceEquals ( null , obj ) )
32+ {
33+ return false ;
34+ }
35+
36+ if ( ReferenceEquals ( this , obj ) )
37+ {
38+ return true ;
39+ }
40+
41+ if ( obj . GetType ( ) != this . GetType ( ) )
42+ {
43+ return false ;
44+ }
45+
46+ return this . Equals ( ( ClientIdAndBroker ) obj ) ;
47+ }
48+
49+ public override int GetHashCode ( )
50+ {
51+ unchecked
52+ {
53+ return ( ( this . ClientId != null ? this . ClientId . GetHashCode ( ) : 0 ) * 397 ) ^ ( this . BrokerInfo != null ? this . BrokerInfo . GetHashCode ( ) : 0 ) ;
54+ }
55+ }
56+ }
2457}
0 commit comments