Last change
on this file since 11296 was 9759, checked in by Don-vip, 8 years ago |
refactor preferences settings classes
|
-
Property svn:eol-style
set to
native
|
File size:
1.1 KB
|
Line | |
---|
1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.data.preferences;
|
---|
3 |
|
---|
4 | /**
|
---|
5 | * Setting containing a {@link String} value.
|
---|
6 | * @since 9759
|
---|
7 | */
|
---|
8 | public class StringSetting extends AbstractSetting<String> {
|
---|
9 | /**
|
---|
10 | * Constructs a new {@code StringSetting} with the given value
|
---|
11 | * @param value The setting value
|
---|
12 | */
|
---|
13 | public StringSetting(String value) {
|
---|
14 | super(value);
|
---|
15 | }
|
---|
16 |
|
---|
17 | @Override
|
---|
18 | public boolean equalVal(String otherVal) {
|
---|
19 | if (value == null)
|
---|
20 | return otherVal == null;
|
---|
21 | return value.equals(otherVal);
|
---|
22 | }
|
---|
23 |
|
---|
24 | @Override
|
---|
25 | public StringSetting copy() {
|
---|
26 | return new StringSetting(value);
|
---|
27 | }
|
---|
28 |
|
---|
29 | @Override
|
---|
30 | public void visit(SettingVisitor visitor) {
|
---|
31 | visitor.visit(this);
|
---|
32 | }
|
---|
33 |
|
---|
34 | @Override
|
---|
35 | public StringSetting getNullInstance() {
|
---|
36 | return new StringSetting(null);
|
---|
37 | }
|
---|
38 |
|
---|
39 | @Override
|
---|
40 | public boolean equals(Object other) {
|
---|
41 | if (!(other instanceof StringSetting))
|
---|
42 | return false;
|
---|
43 | return equalVal(((StringSetting) other).getValue());
|
---|
44 | }
|
---|
45 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.