Last change
on this file since 13250 was 10824, checked in by Don-vip, 8 years ago |
see #13309 - Caching and notifying preferences (patch by michael2402) - gsoc-core
|
File size:
1.1 KB
|
Line | |
---|
1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.data.preferences;
|
---|
3 |
|
---|
4 | /**
|
---|
5 | * A property containing an {@code Long} value.
|
---|
6 | * @since 10087
|
---|
7 | *
|
---|
8 | */
|
---|
9 | public class LongProperty extends AbstractToStringProperty<Long> {
|
---|
10 |
|
---|
11 | /**
|
---|
12 | * Constructs a new {@code LongProperty}
|
---|
13 | * @param key property key
|
---|
14 | * @param defaultValue default value
|
---|
15 | */
|
---|
16 | public LongProperty(String key, long defaultValue) {
|
---|
17 | super(key, defaultValue);
|
---|
18 | }
|
---|
19 |
|
---|
20 | @Override
|
---|
21 | public Long get() {
|
---|
22 | // Removing this implementation breaks binary compatibility
|
---|
23 | return super.get();
|
---|
24 | }
|
---|
25 |
|
---|
26 | @Override
|
---|
27 | public boolean put(Long value) {
|
---|
28 | // Removing this implementation breaks binary compatibility
|
---|
29 | return super.put(value);
|
---|
30 | }
|
---|
31 |
|
---|
32 | @Override
|
---|
33 | protected Long fromString(String string) {
|
---|
34 | try {
|
---|
35 | return Long.valueOf(string);
|
---|
36 | } catch (NumberFormatException e) {
|
---|
37 | throw new InvalidPreferenceValueException(e);
|
---|
38 | }
|
---|
39 | }
|
---|
40 |
|
---|
41 | @Override
|
---|
42 | protected String toString(Long t) {
|
---|
43 | return t.toString();
|
---|
44 | }
|
---|
45 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.