source: josm/trunk/src/org/openstreetmap/josm/gui/mappaint/Keyword.java@ 9371

Last change on this file since 9371 was 9371, checked in by simon04, 9 years ago

Java 7: use Objects.equals and Objects.hash

  • Property svn:eol-style set to native
File size: 1.1 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.mappaint;
3
4import java.util.Locale;
5import java.util.Objects;
6
7public class Keyword {
8 public final String val;
9
10 public Keyword(String val) {
11 this.val = val.toLowerCase(Locale.ENGLISH);
12 }
13
14 @Override
15 public String toString() {
16 return "Keyword{" + val + '}';
17 }
18
19 @Override
20 public boolean equals(Object obj) {
21 if (this == obj) return true;
22 if (obj == null || getClass() != obj.getClass()) return false;
23 Keyword keyword = (Keyword) obj;
24 return Objects.equals(val, keyword.val);
25 }
26
27 @Override
28 public int hashCode() {
29 return Objects.hash(val);
30 }
31
32 public static final Keyword AUTO = new Keyword("auto");
33 public static final Keyword BOTTOM = new Keyword("bottom");
34 public static final Keyword CENTER = new Keyword("center");
35 public static final Keyword DEFAULT = new Keyword("default");
36 public static final Keyword RIGHT = new Keyword("right");
37 public static final Keyword THINNEST = new Keyword("thinnest");
38}
Note: See TracBrowser for help on using the repository browser.