Subversion Repository Public Repository

litesoft

Diff Revisions 947 vs 948 for /trunk/Java/KeyHole/src/org/litesoft/aokeyhole/objects/support/PropertyStringMetaData.java

Diff revisions: vs.
  @@ -4,41 +4,32 @@
4 4 import org.litesoft.aokeyhole.objects.*;
5 5 import org.litesoft.aokeyhole.toolkit.*;
6 6
7 - public abstract class PropertyStringMetaData extends PropertyMetaData
8 - {
7 + public abstract class PropertyStringMetaData extends PropertyMetaData {
9 8 private String[] mValidOptions;
10 9
11 - public PropertyStringMetaData( String pName, Required pRequired, String pInitialValue )
12 - {
10 + public PropertyStringMetaData( String pName, Required pRequired, String pInitialValue ) {
13 11 this( pName, pName, pRequired, pInitialValue );
14 12 }
15 13
16 - public PropertyStringMetaData( String pName, String pDisplayLabel, Required pRequired, String pInitialValue )
17 - {
14 + public PropertyStringMetaData( String pName, String pDisplayLabel, Required pRequired, String pInitialValue ) {
18 15 this( pName, pDisplayLabel, pRequired, pInitialValue, (String[]) null );
19 16 }
20 17
21 - public PropertyStringMetaData( String pName, Required pRequired, String pInitialValue, String... pValidOptions )
22 - {
18 + public PropertyStringMetaData( String pName, Required pRequired, String pInitialValue, String... pValidOptions ) {
23 19 this( pName, pName, pRequired, pInitialValue, pValidOptions );
24 20 }
25 21
26 - public PropertyStringMetaData( String pName, String pDisplayLabel, Required pRequired, String pInitialValue, String... pValidOptions )
27 - {
22 + public PropertyStringMetaData( String pName, String pDisplayLabel, Required pRequired, String pInitialValue, String... pValidOptions ) {
28 23 super( pName, pDisplayLabel, DataType.STRING, pRequired, parse( pInitialValue, pValidOptions ) );
29 24
30 25 mValidOptions = validateValidOptions( pValidOptions );
31 26 }
32 27
33 - private String[] validateValidOptions( String[] pValidOptions )
34 - {
35 - if ( pValidOptions != null )
36 - {
37 - for ( int i = 0; i < pValidOptions.length; i++ )
38 - {
28 + private String[] validateValidOptions( String[] pValidOptions ) {
29 + if ( pValidOptions != null ) {
30 + for ( int i = 0; i < pValidOptions.length; i++ ) {
39 31 String option = trimEmptyToNull( pValidOptions[i] );
40 - if ( option == null )
41 - {
32 + if ( option == null ) {
42 33 throw new IllegalStateException( "Null not allowed as a Valid Option" );
43 34 }
44 35 pValidOptions[i] = option;
  @@ -48,34 +39,26 @@
48 39 }
49 40
50 41 @Override
51 - public String[] getValidOptions()
52 - {
42 + public String[] getValidOptions() {
53 43 return mValidOptions;
54 44 }
55 45
56 46 @Override
57 47 public Object validateAndNormalize( Object pValue )
58 - throws ParseException
59 - {
48 + throws ParseException {
60 49 return parse( pValue, mValidOptions );
61 50 }
62 51
63 52 public static Object parse( Object pValue, String[] pValidOptions )
64 - throws ParseException
65 - {
66 - if ( pValue != null )
67 - {
53 + throws ParseException {
54 + if ( pValue != null ) {
68 55 String value = trimEmptyToNull( pValue.toString() );
69 - if ( value != null )
70 - {
71 - if ( pValidOptions == null )
72 - {
56 + if ( value != null ) {
57 + if ( pValidOptions == null ) {
73 58 return value;
74 59 }
75 - for ( String option : pValidOptions )
76 - {
77 - if ( value.equals( option ) )
78 - {
60 + for ( String option : pValidOptions ) {
61 + if ( value.equals( option ) ) {
79 62 return value;
80 63 }
81 64 }