litesoft
Diff Revisions
947
vs
948
for /trunk/Java/GWT/Client/src/org/litesoft/GWT/client/view/Property.java
|
@@ -3,14 +3,12 @@ |
3 |
3 |
|
|
4 |
4 |
|
import org.litesoft.commonfoundation.typeutils.*; |
5 |
5 |
|
|
6 |
|
- |
public class Property<T> |
7 |
|
- |
{ |
|
6 |
+ |
public class Property<T> { |
8 |
7 |
|
private final Properties mProperties; |
9 |
8 |
|
private final String mName; |
10 |
9 |
|
private final T mDefault; |
11 |
10 |
|
|
12 |
|
- |
public Property( Properties pProperties, String pName ) |
13 |
|
- |
{ |
|
11 |
+ |
public Property( Properties pProperties, String pName ) { |
14 |
12 |
|
this( pProperties, pName, null ); |
15 |
13 |
|
} |
16 |
14 |
|
|
|
@@ -19,8 +17,7 @@ |
19 |
17 |
|
* @param pName non-null |
20 |
18 |
|
* @param pDefault optional |
21 |
19 |
|
*/ |
22 |
|
- |
public Property( Properties pProperties, String pName, T pDefault ) |
23 |
|
- |
{ |
|
20 |
+ |
public Property( Properties pProperties, String pName, T pDefault ) { |
24 |
21 |
|
Objects.assertNotNull( "pProperties", pProperties ); |
25 |
22 |
|
Strings.assertNotNullNotEmpty( "pName", pName ); |
26 |
23 |
|
mProperties = pProperties; |
|
@@ -28,25 +25,21 @@ |
28 |
25 |
|
mDefault = pDefault; |
29 |
26 |
|
} |
30 |
27 |
|
|
31 |
|
- |
public String getName() |
32 |
|
- |
{ |
|
28 |
+ |
public String getName() { |
33 |
29 |
|
return mName; |
34 |
30 |
|
} |
35 |
31 |
|
|
36 |
32 |
|
@SuppressWarnings("unchecked") |
37 |
|
- |
public T get() |
38 |
|
- |
{ |
|
33 |
+ |
public T get() { |
39 |
34 |
|
T value = (T) mProperties.get( getName() ); |
40 |
35 |
|
return (value != null) ? value : mDefault; |
41 |
36 |
|
} |
42 |
37 |
|
|
43 |
|
- |
public T getDefault() |
44 |
|
- |
{ |
|
38 |
+ |
public T getDefault() { |
45 |
39 |
|
return mDefault; |
46 |
40 |
|
} |
47 |
41 |
|
|
48 |
|
- |
public void set( T pValue ) |
49 |
|
- |
{ |
|
42 |
+ |
public void set( T pValue ) { |
50 |
43 |
|
mProperties.set( mName, pValue ); |
51 |
44 |
|
} |
52 |
45 |
|
} |