1 /* 2 * hunt-proton: AMQP Protocol library for D programming language. 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.proton.amqp.messaging.Source; 12 13 14 import hunt.proton.amqp.Symbol; 15 import hunt.proton.amqp.messaging.Terminus; 16 import hunt.proton.amqp.transport.Source; 17 import hunt.proton.amqp.messaging.Outcome; 18 19 import hunt.collection.List; 20 import hunt.collection.ArrayList; 21 import hunt.Object; 22 import hunt.String; 23 24 class Source : Terminus, hunt.proton.amqp.transport.Source.Source 25 { 26 private Symbol _distributionMode; 27 private IObject _filter; 28 private Outcome _defaultOutcome; 29 private List!Symbol _outcomes; 30 31 // override 32 // string toString() 33 // { 34 // return "source: " ~ "_distributionMode = " ~ (_distributionMode is null ? "null": "") ~ 35 // " _filter = " ~ (_filter is null? "null": "") ~ 36 // " _defaultOutcome = " ~ ( _defaultOutcome is null ? "null": "") ~ 37 // " _outcomes = " ~ (_outcomes is null ? "null" : "") ; 38 // } 39 40 this(Source other) { 41 super(other); 42 _distributionMode = other._distributionMode; 43 if (other._filter !is null) 44 _filter = other._filter; 45 _defaultOutcome = other._defaultOutcome; 46 if (other._outcomes !is null) 47 _outcomes = other._outcomes; 48 } 49 50 this() { 51 52 } 53 54 public Symbol getDistributionMode() 55 { 56 return _distributionMode; 57 } 58 59 public void setDistributionMode(Symbol distributionMode) 60 { 61 _distributionMode = distributionMode; 62 } 63 64 public IObject getFilter() 65 { 66 return _filter; 67 } 68 69 public void setFilter(IObject filter) 70 { 71 _filter = filter; 72 } 73 74 public Outcome getDefaultOutcome() 75 { 76 return _defaultOutcome; 77 } 78 79 public void setDefaultOutcome(Outcome defaultOutcome) 80 { 81 _defaultOutcome = defaultOutcome; 82 } 83 84 public List!Symbol getOutcomes() 85 { 86 return _outcomes; 87 } 88 89 public void setOutcomes(List!Symbol outcomes) 90 { 91 _outcomes = outcomes; 92 } 93 94 override string toString() 95 { 96 String address = getAddress(); 97 IObject nodeProperties = getDynamicNodeProperties(); 98 99 return "Source{" ~ 100 "address='" ~ (address is null ? "null" : address.toString()) ~ '\'' ~ 101 ", durable=" ~ getDurable().toString() ~ 102 ", expiryPolicy=" ~ getExpiryPolicy().toString() ~ 103 ", timeout=" ~ getTimeout().toString() ~ 104 ", dynamic=" ~ getDynamic().toString() ~ 105 ", dynamicNodeProperties=" ~ (nodeProperties is null ? "null" : nodeProperties.toString()) ~ 106 ", distributionMode=" ~ (_distributionMode is null ? "null" : _distributionMode.toString()) ~ 107 ", filter=" ~ (_filter is null ? "null" : _filter.toString()) ~ 108 ", defaultOutcome=" ~ (_defaultOutcome is null ? "null" : (cast(Object)_defaultOutcome).toString()) ~ 109 ", outcomes=" ~ (_outcomes is null ? "null" : _outcomes.toString()) ~ 110 ", capabilities=" ~ (getCapabilities() is null ? "null" : getCapabilities().toString()) ~ 111 '}'; 112 } 113 114 override 115 public hunt.proton.amqp.transport.Source.Source copy() { 116 return new Source(this); 117 } 118 119 override 120 String getAddress() 121 { 122 return super.getAddress(); 123 } 124 } 125