litesoft
Diff Revisions
947
vs
948
for /trunk/GWT_Sandbox/MultiModuleSingleSrc/main/src/org/litesoft/sandbox/multimodule/client/foundation/support/LuckyIdCodec.java
|
@@ -1,24 +1,17 @@ |
1 |
1 |
|
package org.litesoft.sandbox.multimodule.client.foundation.support; |
2 |
2 |
|
|
3 |
|
- |
public class LuckyIdCodec |
4 |
|
- |
{ |
5 |
|
- |
public static String encode( Long luckyId ) |
6 |
|
- |
{ |
|
3 |
+ |
public class LuckyIdCodec { |
|
4 |
+ |
public static String encode( Long luckyId ) { |
7 |
5 |
|
return (luckyId == null) ? null : Long.toOctalString( luckyId + Integer.MAX_VALUE ); |
8 |
6 |
|
} |
9 |
7 |
|
|
10 |
|
- |
public static Long decode( String luckyId ) |
11 |
|
- |
{ |
12 |
|
- |
if ( luckyId != null ) |
13 |
|
- |
{ |
14 |
|
- |
if ( (luckyId = luckyId.trim()).length() != 0 ) |
15 |
|
- |
{ |
16 |
|
- |
try |
17 |
|
- |
{ |
|
8 |
+ |
public static Long decode( String luckyId ) { |
|
9 |
+ |
if ( luckyId != null ) { |
|
10 |
+ |
if ( (luckyId = luckyId.trim()).length() != 0 ) { |
|
11 |
+ |
try { |
18 |
12 |
|
return Long.parseLong( luckyId, 8 ) - Integer.MAX_VALUE; |
19 |
13 |
|
} |
20 |
|
- |
catch ( NumberFormatException e ) |
21 |
|
- |
{ |
|
14 |
+ |
catch ( NumberFormatException e ) { |
22 |
15 |
|
// Ignore... |
23 |
16 |
|
} |
24 |
17 |
|
} |