]> git.basschouten.com Git - openhab-addons.git/blob
c8d1befbd1d94556b5c3e3e0ceb6ae1c0e45c2b3
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2021 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.tr064.internal.soap;
14
15 import java.util.Map;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19 import org.openhab.binding.tr064.internal.dto.scpd.root.SCPDServiceType;
20
21 /**
22  * The {@link SOAPRequest} is a wrapper for SOAP requests
23  *
24  * @author Jan N. Klug - Initial contribution
25  */
26 @NonNullByDefault
27 public class SOAPRequest {
28     public SCPDServiceType service;
29     public String soapAction;
30     public Map<String, String> arguments = Map.of();
31
32     public SOAPRequest(SCPDServiceType service, String soapAction) {
33         this.service = service;
34         this.soapAction = soapAction;
35     }
36
37     public SOAPRequest(SCPDServiceType service, String soapAction, Map<String, String> arguments) {
38         this.service = service;
39         this.soapAction = soapAction;
40         this.arguments = arguments;
41     }
42
43     @Override
44     public boolean equals(@Nullable Object o) {
45         if (this == o)
46             return true;
47         if (o == null || getClass() != o.getClass())
48             return false;
49
50         SOAPRequest that = (SOAPRequest) o;
51
52         if (!service.equals(that.service))
53             return false;
54         if (!soapAction.equals(that.soapAction))
55             return false;
56         return arguments.equals(that.arguments);
57     }
58
59     @Override
60     public int hashCode() {
61         int result = service.hashCode();
62         result = 31 * result + soapAction.hashCode();
63         result = 31 * result + arguments.hashCode();
64         return result;
65     }
66
67     @Override
68     public String toString() {
69         return "SOAPRequest{" + "service=" + service + ", soapAction='" + soapAction + '\'' + ", arguments=" + arguments
70                 + '}';
71     }
72 }