|
16 | 16 |
|
17 | 17 | package org.springframework.rabbit.stream.support;
|
18 | 18 |
|
| 19 | +import java.util.Objects; |
| 20 | + |
19 | 21 | import org.springframework.amqp.core.MessageProperties;
|
20 | 22 | import org.springframework.lang.Nullable;
|
21 | 23 |
|
22 |
| -import com.rabbitmq.stream.MessageBuilder.PropertiesBuilder; |
23 | 24 | import com.rabbitmq.stream.MessageHandler.Context;
|
24 |
| -import com.rabbitmq.stream.Properties; |
25 | 25 |
|
26 | 26 | /**
|
27 | 27 | * {@link MessageProperties} extension for stream messages.
|
@@ -66,99 +66,128 @@ public Context getContext() {
|
66 | 66 | }
|
67 | 67 |
|
68 | 68 | /**
|
69 |
| - * See {@link Properties#getTo()}. |
| 69 | + * See {@link com.rabbitmq.stream.Properties#getTo()}. |
70 | 70 | * @return the to address.
|
71 | 71 | */
|
72 | 72 | public String getTo() {
|
73 | 73 | return this.to;
|
74 | 74 | }
|
75 | 75 |
|
76 | 76 | /**
|
77 |
| - * See {@link PropertiesBuilder#to(String)}. |
| 77 | + * See {@link com.rabbitmq.stream.MessageBuilder.PropertiesBuilder#to(String)}. |
78 | 78 | * @param address the address.
|
79 | 79 | */
|
80 | 80 | public void setTo(String address) {
|
81 | 81 | this.to = address;
|
82 | 82 | }
|
83 | 83 |
|
84 | 84 | /**
|
85 |
| - * See {@link Properties#getSubject()}. |
| 85 | + * See {@link com.rabbitmq.stream.Properties#getSubject()}. |
86 | 86 | * @return the subject.
|
87 | 87 | */
|
88 | 88 | public String getSubject() {
|
89 | 89 | return this.subject;
|
90 | 90 | }
|
91 | 91 |
|
92 | 92 | /**
|
93 |
| - * See {@link PropertiesBuilder#subject(String)}. |
| 93 | + * See {@link com.rabbitmq.stream.MessageBuilder.PropertiesBuilder#subject(String)}. |
94 | 94 | * @param subject the subject.
|
95 | 95 | */
|
96 | 96 | public void setSubject(String subject) {
|
97 | 97 | this.subject = subject;
|
98 | 98 | }
|
99 | 99 |
|
100 | 100 | /**
|
101 |
| - * See {@link Properties#getCreationTime()}. |
| 101 | + * See {@link com.rabbitmq.stream.Properties#getCreationTime()}. |
102 | 102 | * @return the creation time.
|
103 | 103 | */
|
104 | 104 | public long getCreationTime() {
|
105 | 105 | return this.creationTime;
|
106 | 106 | }
|
107 | 107 |
|
108 | 108 | /**
|
109 |
| - * See {@link PropertiesBuilder#creationTime(long)}. |
| 109 | + * See |
| 110 | + * {@link com.rabbitmq.stream.MessageBuilder.PropertiesBuilder#creationTime(long)}. |
110 | 111 | * @param creationTime the creation time.
|
111 | 112 | */
|
112 | 113 | public void setCreationTime(long creationTime) {
|
113 | 114 | this.creationTime = creationTime;
|
114 | 115 | }
|
115 | 116 |
|
116 | 117 | /**
|
117 |
| - * See {@link Properties#getGroupId()}. |
| 118 | + * See {@link com.rabbitmq.stream.Properties#getGroupId()}. |
118 | 119 | * @return the group id.
|
119 | 120 | */
|
120 | 121 | public String getGroupId() {
|
121 | 122 | return this.groupId;
|
122 | 123 | }
|
123 | 124 |
|
124 | 125 | /**
|
125 |
| - * See {@link PropertiesBuilder#groupId(String)}. |
| 126 | + * See {@link com.rabbitmq.stream.MessageBuilder.PropertiesBuilder#groupId(String)}. |
126 | 127 | * @param groupId the group id.
|
127 | 128 | */
|
128 | 129 | public void setGroupId(String groupId) {
|
129 | 130 | this.groupId = groupId;
|
130 | 131 | }
|
131 | 132 |
|
132 | 133 | /**
|
133 |
| - * See {@link Properties#getGroupSequence()}. |
| 134 | + * See {@link com.rabbitmq.stream.Properties#getGroupSequence()}. |
134 | 135 | * @return the group sequence.
|
135 | 136 | */
|
136 | 137 | public long getGroupSequence() {
|
137 | 138 | return this.groupSequence;
|
138 | 139 | }
|
139 | 140 |
|
140 | 141 | /**
|
141 |
| - * See {@link PropertiesBuilder#groupSequence(long)}. |
| 142 | + * See |
| 143 | + * {@link com.rabbitmq.stream.MessageBuilder.PropertiesBuilder#groupSequence(long)}. |
142 | 144 | * @param groupSequence the group sequence.
|
143 | 145 | */
|
144 | 146 | public void setGroupSequence(long groupSequence) {
|
145 | 147 | this.groupSequence = groupSequence;
|
146 | 148 | }
|
147 | 149 |
|
148 | 150 | /**
|
149 |
| - * See {@link Properties#getReplyToGroupId()}. |
| 151 | + * See {@link com.rabbitmq.stream.Properties#getReplyToGroupId()}. |
150 | 152 | * @return the reply to group id.
|
151 | 153 | */
|
152 | 154 | public String getReplyToGroupId() {
|
153 | 155 | return this.replyToGroupId;
|
154 | 156 | }
|
155 | 157 |
|
156 | 158 | /**
|
157 |
| - * See {@link PropertiesBuilder#replyToGroupId(String)}. |
| 159 | + * See |
| 160 | + * {@link com.rabbitmq.stream.MessageBuilder.PropertiesBuilder#replyToGroupId(String)}. |
158 | 161 | * @param replyToGroupId the reply to group id.
|
159 | 162 | */
|
160 | 163 | public void setReplyToGroupId(String replyToGroupId) {
|
161 | 164 | this.replyToGroupId = replyToGroupId;
|
162 | 165 | }
|
163 | 166 |
|
| 167 | + @Override |
| 168 | + public int hashCode() { |
| 169 | + final int prime = 31; |
| 170 | + int result = super.hashCode(); |
| 171 | + result = prime * result + Objects.hash(creationTime, groupId, groupSequence, replyToGroupId, subject, to); |
| 172 | + return result; |
| 173 | + } |
| 174 | + |
| 175 | + @Override |
| 176 | + public boolean equals(Object obj) { |
| 177 | + if (this == obj) { |
| 178 | + return true; |
| 179 | + } |
| 180 | + if (!super.equals(obj)) { |
| 181 | + return false; |
| 182 | + } |
| 183 | + if (getClass() != obj.getClass()) { |
| 184 | + return false; |
| 185 | + } |
| 186 | + StreamMessageProperties other = (StreamMessageProperties) obj; |
| 187 | + return this.creationTime == other.creationTime && Objects.equals(this.groupId, other.groupId) |
| 188 | + && this.groupSequence == other.groupSequence |
| 189 | + && Objects.equals(this.replyToGroupId, other.replyToGroupId) |
| 190 | + && Objects.equals(this.subject, other.subject) && Objects.equals(this.to, other.to); |
| 191 | + } |
| 192 | + |
164 | 193 | }
|
0 commit comments