Last change
on this file since 19076 was 15377, checked in by Don-vip, 5 years ago |
see #13679 - refactor session import/export classes for easier plugin extensions
|
-
Property svn:eol-style
set to
native
|
File size:
1.5 KB
|
Line | |
---|
1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.data.osm;
|
---|
3 |
|
---|
4 | import java.io.Serializable;
|
---|
5 | import java.util.Objects;
|
---|
6 | import java.util.Set;
|
---|
7 |
|
---|
8 | /**
|
---|
9 | * Class representing multiple values of a given key.
|
---|
10 | * @since 15376
|
---|
11 | */
|
---|
12 | public class Tags implements Serializable {
|
---|
13 |
|
---|
14 | private static final long serialVersionUID = 1;
|
---|
15 |
|
---|
16 | private final String key;
|
---|
17 | private final Set<String> values;
|
---|
18 |
|
---|
19 | /**
|
---|
20 | * Constructs a new {@code Tags}.
|
---|
21 | * @param key the key. Must not be null
|
---|
22 | * @param values the values. Must not be null
|
---|
23 | */
|
---|
24 | public Tags(String key, Set<String> values) {
|
---|
25 | this.key = Objects.requireNonNull(key);
|
---|
26 | this.values = Objects.requireNonNull(values);
|
---|
27 | }
|
---|
28 |
|
---|
29 | /**
|
---|
30 | * Returns the key.
|
---|
31 | * @return the key
|
---|
32 | */
|
---|
33 | public String getKey() {
|
---|
34 | return key;
|
---|
35 | }
|
---|
36 |
|
---|
37 | /**
|
---|
38 | * Returns the values.
|
---|
39 | * @return the values
|
---|
40 | */
|
---|
41 | public Set<String> getValues() {
|
---|
42 | return values;
|
---|
43 | }
|
---|
44 |
|
---|
45 | @Override
|
---|
46 | public int hashCode() {
|
---|
47 | return Objects.hash(key, values);
|
---|
48 | }
|
---|
49 |
|
---|
50 | @Override
|
---|
51 | public boolean equals(Object obj) {
|
---|
52 | if (this == obj)
|
---|
53 | return true;
|
---|
54 | if (obj == null || getClass() != obj.getClass())
|
---|
55 | return false;
|
---|
56 | Tags other = (Tags) obj;
|
---|
57 | return Objects.equals(key, other.key) && Objects.equals(values, other.values);
|
---|
58 | }
|
---|
59 |
|
---|
60 | @Override
|
---|
61 | public String toString() {
|
---|
62 | return "Tags [key=" + key + ", values=" + values + ']';
|
---|
63 | }
|
---|
64 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.