1 /*
2  * hunt-amqp: AMQP library for D programming language, based on hunt-net.
3  *
4  * Copyright (C) 2018-2019 HuntLabs
5  *
6  * Website: https://www.huntlabs.net
7  *
8  * Licensed under the Apache-2.0 License.
9  *
10  */
11 module hunt.amqp.sasl.impl.ProtonSaslMechanismImpl;
12 
13 import hunt.amqp.sasl.ProtonSaslMechanism;
14 
15 abstract class ProtonSaslMechanismImpl : ProtonSaslMechanism {
16 
17   protected static  byte[] EMPTY;
18 
19   private string username;
20   private string password;
21 
22   override
23   public int opCmp(ProtonSaslMechanism other) {
24 
25     if (getPriority() < other.getPriority()) {
26       return -1;
27     } else if (getPriority() > other.getPriority()) {
28       return 1;
29     }
30 
31     return 0;
32   }
33 
34   public ProtonSaslMechanism setUsername(string value) {
35     this.username = value;
36     return this;
37   }
38 
39   public string getUsername() {
40     return username;
41   }
42 
43   public ProtonSaslMechanism setPassword(string value) {
44     this.password = value;
45     return this;
46   }
47 
48   public string getPassword() {
49     return this.password;
50   }
51 
52   override
53   public string toString() {
54     return "SASL-" ~ getName();
55   }
56 }