|
@@ -2,62 +2,50 @@ |
2 |
2 |
|
package org.litesoft.GWT.forms.server.support.nonpublic; |
3 |
3 |
|
|
4 |
4 |
|
import org.litesoft.commonfoundation.typeutils.Objects; |
5 |
|
- |
import java.util.*; |
6 |
|
- |
|
7 |
5 |
|
import org.litesoft.core.simpletypes.*; |
|
6 |
+ |
|
8 |
7 |
|
import java.io.*; |
|
8 |
+ |
import java.util.*; |
9 |
9 |
|
|
10 |
|
- |
public abstract class AbstractSendableKeyValuePairConverter extends AbstractSendableDataConverter |
11 |
|
- |
{ |
12 |
|
- |
protected Serializable convertNotNullToPassable( Object pValue ) |
13 |
|
- |
{ |
|
10 |
+ |
public abstract class AbstractSendableKeyValuePairConverter extends AbstractSendableDataConverter { |
|
11 |
+ |
protected Serializable convertNotNullToPassable( Object pValue ) { |
14 |
12 |
|
return createSimpleKeyValuePair( pValue ); |
15 |
13 |
|
} |
16 |
14 |
|
|
17 |
|
- |
protected Object convertNotNullNotBoxedTypeFromPassable( Serializable pValue ) |
18 |
|
- |
{ |
|
15 |
+ |
protected Object convertNotNullNotBoxedTypeFromPassable( Serializable pValue ) { |
19 |
16 |
|
return (pValue instanceof SimpleKeyValuePair) ? // |
20 |
17 |
|
convertSimpleKeyValuePairKey( ((SimpleKeyValuePair) pValue).getKey() ) : // |
21 |
18 |
|
pValue.toString(); |
22 |
19 |
|
} |
23 |
20 |
|
|
24 |
|
- |
protected Object convertSimpleKeyValuePairKey( Object pKey ) |
25 |
|
- |
{ |
|
21 |
+ |
protected Object convertSimpleKeyValuePairKey( Object pKey ) { |
26 |
22 |
|
return pKey; |
27 |
23 |
|
} |
28 |
24 |
|
|
29 |
25 |
|
abstract protected SimpleKeyValuePair createSimpleKeyValuePair( Object pOption ); |
30 |
26 |
|
|
31 |
27 |
|
public SimpleKeyValuePair[] createValidOptions( Object[] pValidOptions, |
32 |
|
- |
String[] pAltOrLimitingValidOptions ) |
33 |
|
- |
{ |
34 |
|
- |
if ( Objects.isNullOrEmpty( pValidOptions ) ) |
35 |
|
- |
{ |
36 |
|
- |
if ( Objects.isNullOrEmpty( pValidOptions = pAltOrLimitingValidOptions ) ) |
37 |
|
- |
{ |
|
28 |
+ |
String[] pAltOrLimitingValidOptions ) { |
|
29 |
+ |
if ( Objects.isNullOrEmpty( pValidOptions ) ) { |
|
30 |
+ |
if ( Objects.isNullOrEmpty( pValidOptions = pAltOrLimitingValidOptions ) ) { |
38 |
31 |
|
return SimpleKeyValuePair.EMPTY_ARRAY; |
39 |
32 |
|
} |
40 |
33 |
|
} |
41 |
|
- |
if ( (pValidOptions == pAltOrLimitingValidOptions) || (pAltOrLimitingValidOptions == null) ) |
42 |
|
- |
{ |
|
34 |
+ |
if ( (pValidOptions == pAltOrLimitingValidOptions) || (pAltOrLimitingValidOptions == null) ) { |
43 |
35 |
|
SimpleKeyValuePair[] rv = new SimpleKeyValuePair[pValidOptions.length]; |
44 |
|
- |
for ( int i = 0; i < pValidOptions.length; i++ ) |
45 |
|
- |
{ |
|
36 |
+ |
for ( int i = 0; i < pValidOptions.length; i++ ) { |
46 |
37 |
|
rv[i] = createSimpleKeyValuePair( pValidOptions[i] ); |
47 |
38 |
|
} |
48 |
39 |
|
return rv; |
49 |
40 |
|
} |
50 |
41 |
|
Set<String> zLimitTo = new HashSet<String>(); |
51 |
|
- |
for ( String option : pAltOrLimitingValidOptions ) |
52 |
|
- |
{ |
|
42 |
+ |
for ( String option : pAltOrLimitingValidOptions ) { |
53 |
43 |
|
zLimitTo.add( createSimpleKeyValuePair( option ).toStringValue() ); |
54 |
44 |
|
} |
55 |
45 |
|
List<SimpleKeyValuePair> rv = new ArrayList<SimpleKeyValuePair>(); |
56 |
|
- |
for ( Object option : pValidOptions ) |
57 |
|
- |
{ |
|
46 |
+ |
for ( Object option : pValidOptions ) { |
58 |
47 |
|
SimpleKeyValuePair possibleEntry = createSimpleKeyValuePair( option ); |
59 |
|
- |
if ( zLimitTo.contains( possibleEntry.toStringValue() ) ) |
60 |
|
- |
{ |
|
48 |
+ |
if ( zLimitTo.contains( possibleEntry.toStringValue() ) ) { |
61 |
49 |
|
rv.add( possibleEntry ); |
62 |
50 |
|
} |
63 |
51 |
|
} |