|
@@ -1,25 +1,22 @@ |
1 |
1 |
|
package org.litesoft.GWT.client.pavsupport; |
2 |
2 |
|
|
3 |
|
- |
import java.util.*; |
4 |
|
- |
|
5 |
3 |
|
import org.litesoft.codec.*; |
6 |
4 |
|
import org.litesoft.core.util.*; |
7 |
5 |
|
|
8 |
6 |
|
import com.google.gwt.place.shared.*; |
9 |
7 |
|
|
|
8 |
+ |
import java.util.*; |
|
9 |
+ |
|
10 |
10 |
|
public abstract class IdTokenizer<T extends Place> implements PlaceTokenizer<T>, |
11 |
|
- |
HasPlaceId |
12 |
|
- |
{ |
|
11 |
+ |
HasPlaceId { |
13 |
12 |
|
private String mPlaceId; |
14 |
13 |
|
|
15 |
|
- |
protected IdTokenizer( Object pPlaceId ) |
16 |
|
- |
{ |
|
14 |
+ |
protected IdTokenizer( Object pPlaceId ) { |
17 |
15 |
|
mPlaceId = pPlaceId.toString(); |
18 |
16 |
|
} |
19 |
17 |
|
|
20 |
18 |
|
@Override |
21 |
|
- |
public String getPlaceId() |
22 |
|
- |
{ |
|
19 |
+ |
public String getPlaceId() { |
23 |
20 |
|
return mPlaceId; |
24 |
21 |
|
} |
25 |
22 |
|
|
|
@@ -28,8 +25,7 @@ |
28 |
25 |
|
* |
29 |
26 |
|
* @return "" if null passed OR no strings, individual nulls treated as "" |
30 |
27 |
|
*/ |
31 |
|
- |
protected String encode( String... strings ) |
32 |
|
- |
{ |
|
28 |
+ |
protected String encode( String... strings ) { |
33 |
29 |
|
return encodePacked( MultiStringPackaging.pack( strings ) ); |
34 |
30 |
|
} |
35 |
31 |
|
|
|
@@ -38,8 +34,7 @@ |
38 |
34 |
|
* |
39 |
35 |
|
* @return "" if null passed OR no strings, individual nulls treated as "" |
40 |
36 |
|
*/ |
41 |
|
- |
protected String encode( List<String> strings ) |
42 |
|
- |
{ |
|
37 |
+ |
protected String encode( List<String> strings ) { |
43 |
38 |
|
return encodePacked( MultiStringPackaging.pack( strings ) ); |
44 |
39 |
|
} |
45 |
40 |
|
|
|
@@ -47,11 +42,10 @@ |
47 |
42 |
|
* Decode the passed String into multiple Strings. |
48 |
43 |
|
* |
49 |
44 |
|
* @return empty if "" or null passed OR the data can not be unpacked, |
50 |
|
- |
* otherwise the list will be at least one string and no entries |
51 |
|
- |
* will be null |
|
45 |
+ |
* otherwise the list will be at least one string and no entries |
|
46 |
+ |
* will be null |
52 |
47 |
|
*/ |
53 |
|
- |
protected List<String> decode( String encoded ) |
54 |
|
- |
{ |
|
48 |
+ |
protected List<String> decode( String encoded ) { |
55 |
49 |
|
return decode( encoded, 0 ); |
56 |
50 |
|
} |
57 |
51 |
|
|
|
@@ -59,22 +53,19 @@ |
59 |
53 |
|
* Decode the passed String into multiple Strings. |
60 |
54 |
|
* |
61 |
55 |
|
* @return empty if minimumListSize < 1 AND (null or "" passed, OR the data |
62 |
|
- |
* can not be unpacked) otherwise the list will be at least |
63 |
|
- |
* minimumListSize (or 1 if minimumListSize < 1) and no entries will |
64 |
|
- |
* be null. |
|
56 |
+ |
* can not be unpacked) otherwise the list will be at least |
|
57 |
+ |
* minimumListSize (or 1 if minimumListSize < 1) and no entries will |
|
58 |
+ |
* be null. |
65 |
59 |
|
*/ |
66 |
|
- |
protected static List<String> decode( String encoded, int minimumListSize ) |
67 |
|
- |
{ |
|
60 |
+ |
protected static List<String> decode( String encoded, int minimumListSize ) { |
68 |
61 |
|
return MultiStringPackaging.unpack( VersioningCodec.INSTANCE.decode( encoded ), minimumListSize ); |
69 |
62 |
|
} |
70 |
63 |
|
|
71 |
|
- |
private String encodePacked( String packed ) |
72 |
|
- |
{ |
|
64 |
+ |
private String encodePacked( String packed ) { |
73 |
65 |
|
return VersioningCodec.INSTANCE.encode( packed ); |
74 |
66 |
|
} |
75 |
67 |
|
|
76 |
|
- |
protected String toString( Object object ) |
77 |
|
- |
{ |
|
68 |
+ |
protected String toString( Object object ) { |
78 |
69 |
|
return (object != null) ? object.toString() : null; |
79 |
70 |
|
} |
80 |
71 |
|
} |