Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/shared/model/IntegerProperty.java @ 1507:c21d14e48040
Improved validation and property handling.
flys-client/trunk@3645 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Wed, 11 Jan 2012 10:21:22 +0000 |
parents | 3304608baf35 |
children |
comparison
equal
deleted
inserted
replaced
1506:339f8aa641b5 | 1507:c21d14e48040 |
---|---|
20 * @param name The attribute name. | 20 * @param name The attribute name. |
21 * @param value The current value. | 21 * @param value The current value. |
22 */ | 22 */ |
23 public IntegerProperty( | 23 public IntegerProperty( |
24 String name, | 24 String name, |
25 String value) | 25 Integer value) |
26 { | 26 { |
27 this.name = name; | 27 this.name = name; |
28 this.value = value; | 28 this.value = value.toString(); |
29 this.attributes = new HashMap<String, String>(); | 29 this.attributes = new HashMap<String, String>(); |
30 } | 30 } |
31 | 31 |
32 | |
33 @Override | |
34 public Integer getValue() { | |
35 try { | |
36 return Integer.valueOf(this.value); | |
37 } | |
38 catch(NumberFormatException nfe) { | |
39 return null; | |
40 } | |
41 } | |
42 | |
43 | |
44 public void setValue(Integer value) { | |
45 this.value = value.toString(); | |
46 } | |
32 | 47 |
33 public Object clone() { | 48 public Object clone() { |
34 IntegerProperty clone = new IntegerProperty(this.getName(), | 49 IntegerProperty clone = new IntegerProperty(this.getName(), |
35 this.getValue()); | 50 this.getValue()); |
36 for(String s: this.getAttributeList()) { | 51 for(String s: this.getAttributeList()) { |