BrightSide Workbench Full Report + Source Code
ServiceNamePair.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2022 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 package org.turro.ws;
20 
21 import java.util.Map;
22 import java.util.Objects;
23 import javax.json.JsonValue;
24 import org.turro.json.IJSONizable;
25 
30 public class ServiceNamePair implements IJSONizable {
31 
32  private final String service, name;
33 
34  public ServiceNamePair(String service, String name) {
35  this.service = service;
36  this.name = name;
37  }
38 
39  public String getService() {
40  return service;
41  }
42 
43  public String getName() {
44  return name;
45  }
46 
47  /* IJSONizable */
48 
49  @Override
50  public String toJson() {
51  return toJson(this);
52  }
53 
54  @Override
55  public String toJson(Map<String, Object> properties) {
56  return toJson(this, properties);
57  }
58 
59  public static ServiceNamePair fromJson(JsonValue value) {
60  return IJSONizable.fromJson(value.toString(), ServiceNamePair.class);
61  }
62 
63  /* Equals */
64 
65  @Override
66  public int hashCode() {
67  int hash = 3;
68  hash = 37 * hash + Objects.hashCode(this.service);
69  return hash;
70  }
71 
72  @Override
73  public boolean equals(Object obj) {
74  if (this == obj) {
75  return true;
76  }
77  if (obj == null) {
78  return false;
79  }
80  if (getClass() != obj.getClass()) {
81  return false;
82  }
83  final ServiceNamePair other = (ServiceNamePair) obj;
84  return Objects.equals(this.service, other.service);
85  }
86 
87 }
ServiceNamePair(String service, String name)
static ServiceNamePair fromJson(JsonValue value)
String toJson(Map< String, Object > properties)