litesoft
Diff Revisions
947
vs
948
for /trunk/Java/KeyHole/src/org/litesoft/aokeyhole/objects/PropertyMetaData.java
|
@@ -4,8 +4,7 @@ |
4 |
4 |
|
import org.litesoft.aokeyhole.objects.support.*; |
5 |
5 |
|
import org.litesoft.aokeyhole.toolkit.*; |
6 |
6 |
|
|
7 |
|
- |
public abstract class PropertyMetaData extends AbstractConfigMetaData implements ValueStringConverter |
8 |
|
- |
{ |
|
7 |
+ |
public abstract class PropertyMetaData extends AbstractConfigMetaData implements ValueStringConverter { |
9 |
8 |
|
public static final PropertyMetaData[] EMPTY_ARRAY = new PropertyMetaData[0]; |
10 |
9 |
|
|
11 |
10 |
|
public static final String TYPE = "Property"; |
|
@@ -16,8 +15,7 @@ |
16 |
15 |
|
private Required mRequired; |
17 |
16 |
|
private Object mInitialValue; |
18 |
17 |
|
|
19 |
|
- |
protected PropertyMetaData( String pName, String pDisplayLabel, DataType pDataType, Required pRequired, Object pInitialValue ) |
20 |
|
- |
{ |
|
18 |
+ |
protected PropertyMetaData( String pName, String pDisplayLabel, DataType pDataType, Required pRequired, Object pInitialValue ) { |
21 |
19 |
|
super( TYPE ); |
22 |
20 |
|
|
23 |
21 |
|
mName = noNull( pName, "Name" ); |
|
@@ -27,63 +25,51 @@ |
27 |
25 |
|
mInitialValue = pInitialValue; |
28 |
26 |
|
} |
29 |
27 |
|
|
30 |
|
- |
public String getName() |
31 |
|
- |
{ |
|
28 |
+ |
public String getName() { |
32 |
29 |
|
return mName; |
33 |
30 |
|
} |
34 |
31 |
|
|
35 |
|
- |
public String getDisplayLabel() |
36 |
|
- |
{ |
|
32 |
+ |
public String getDisplayLabel() { |
37 |
33 |
|
return mDisplayLabel; |
38 |
34 |
|
} |
39 |
35 |
|
|
40 |
|
- |
public DataType getDataType() |
41 |
|
- |
{ |
|
36 |
+ |
public DataType getDataType() { |
42 |
37 |
|
return mDataType; |
43 |
38 |
|
} |
44 |
39 |
|
|
45 |
|
- |
public Required getRequired() |
46 |
|
- |
{ |
|
40 |
+ |
public Required getRequired() { |
47 |
41 |
|
return mRequired; |
48 |
42 |
|
} |
49 |
43 |
|
|
50 |
|
- |
public Object getInitialValue() |
51 |
|
- |
{ |
|
44 |
+ |
public Object getInitialValue() { |
52 |
45 |
|
return mInitialValue; |
53 |
46 |
|
} |
54 |
47 |
|
|
55 |
|
- |
public String[] getValidOptions() |
56 |
|
- |
{ |
|
48 |
+ |
public String[] getValidOptions() { |
57 |
49 |
|
return null; |
58 |
50 |
|
} |
59 |
51 |
|
|
60 |
52 |
|
@Override |
61 |
53 |
|
public Object validateAndNormalize( Object pValue ) |
62 |
|
- |
throws ParseException |
63 |
|
- |
{ |
|
54 |
+ |
throws ParseException { |
64 |
55 |
|
return pValue; |
65 |
56 |
|
} |
66 |
57 |
|
|
67 |
58 |
|
@Override |
68 |
|
- |
public String valueToString( Object pValue ) |
69 |
|
- |
{ |
|
59 |
+ |
public String valueToString( Object pValue ) { |
70 |
60 |
|
return (pValue == null) ? "" : pValue.toString(); |
71 |
61 |
|
} |
72 |
62 |
|
|
73 |
|
- |
protected String noNull( String pOrig, String pWhat ) |
74 |
|
- |
{ |
75 |
|
- |
if ( pOrig == null ) |
76 |
|
- |
{ |
|
63 |
+ |
protected String noNull( String pOrig, String pWhat ) { |
|
64 |
+ |
if ( pOrig == null ) { |
77 |
65 |
|
throw new IllegalStateException( pWhat + " may Not be null" ); |
78 |
66 |
|
} |
79 |
67 |
|
|
80 |
68 |
|
return pOrig; |
81 |
69 |
|
} |
82 |
70 |
|
|
83 |
|
- |
protected DataType noNull( DataType pOrig, String pWhat ) |
84 |
|
- |
{ |
85 |
|
- |
if ( pOrig == null ) |
86 |
|
- |
{ |
|
71 |
+ |
protected DataType noNull( DataType pOrig, String pWhat ) { |
|
72 |
+ |
if ( pOrig == null ) { |
87 |
73 |
|
throw new IllegalStateException( pWhat + " may Not be null" ); |
88 |
74 |
|
} |
89 |
75 |
|
|
|
@@ -91,8 +77,7 @@ |
91 |
77 |
|
} |
92 |
78 |
|
|
93 |
79 |
|
@Override |
94 |
|
- |
public String toString() |
95 |
|
- |
{ |
|
80 |
+ |
public String toString() { |
96 |
81 |
|
return mName + (mRequired.isData() ? "*" : ""); |
97 |
82 |
|
} |
98 |
83 |
|
} |