litesoft
Diff Revisions
949
vs
950
for /trunk/Java/GWT/OldClient/src/org/litesoft/GWT/eventbus/client/ClientIdCodec.java
|
@@ -1,23 +1,23 @@ |
1 |
|
- |
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
|
- |
package org.litesoft.GWT.eventbus.client; |
3 |
|
- |
|
4 |
|
- |
import org.litesoft.commonfoundation.typeutils.*; |
5 |
|
- |
|
6 |
|
- |
public class ClientIdCodec { |
7 |
|
- |
public static Integer decode( String pEncodedClientId ) { |
8 |
|
- |
pEncodedClientId = Strings.noEmpty( pEncodedClientId ); |
9 |
|
- |
if ( pEncodedClientId != null ) { |
10 |
|
- |
try { |
11 |
|
- |
return new Integer( pEncodedClientId ); |
12 |
|
- |
} |
13 |
|
- |
catch ( NumberFormatException e ) { |
14 |
|
- |
// Whatever... |
15 |
|
- |
} |
16 |
|
- |
} |
17 |
|
- |
return null; |
18 |
|
- |
} |
19 |
|
- |
|
20 |
|
- |
public static String encode( int pClientIdNumber ) { |
21 |
|
- |
return "" + pClientIdNumber; |
22 |
|
- |
} |
23 |
|
- |
} |
|
1 |
+ |
// This Source Code is in the Public Domain per: http://unlicense.org |
|
2 |
+ |
package org.litesoft.GWT.eventbus.client; |
|
3 |
+ |
|
|
4 |
+ |
import org.litesoft.commonfoundation.base.*; |
|
5 |
+ |
|
|
6 |
+ |
public class ClientIdCodec { |
|
7 |
+ |
public static Integer decode( String pEncodedClientId ) { |
|
8 |
+ |
pEncodedClientId = ConstrainTo.significantOrNull( pEncodedClientId ); |
|
9 |
+ |
if ( pEncodedClientId != null ) { |
|
10 |
+ |
try { |
|
11 |
+ |
return new Integer( pEncodedClientId ); |
|
12 |
+ |
} |
|
13 |
+ |
catch ( NumberFormatException e ) { |
|
14 |
+ |
// Whatever... |
|
15 |
+ |
} |
|
16 |
+ |
} |
|
17 |
+ |
return null; |
|
18 |
+ |
} |
|
19 |
+ |
|
|
20 |
+ |
public static String encode( int pClientIdNumber ) { |
|
21 |
+ |
return "" + pClientIdNumber; |
|
22 |
+ |
} |
|
23 |
+ |
} |