Subversion Repository Public Repository

litesoft

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package org.litesoft.sandbox.multimodule.foundation.client.support;

public class LuckyIdCodec {
    public static String encode( Long luckyId ) {
        return (luckyId == null) ? null : Long.toOctalString( luckyId + Integer.MAX_VALUE );
    }

    public static Long decode( String luckyId ) {
        if ( luckyId != null ) {
            if ( (luckyId = luckyId.trim()).length() != 0 ) {
                try {
                    return Long.parseLong( luckyId, 8 ) - Integer.MAX_VALUE;
                }
                catch ( NumberFormatException e ) {
                    // Ignore...
                }
            }
        }
        return null;
    }
}

Commits for litesoft/trunk/GWT_Sandbox/MultiModule/foundation/src/org/litesoft/sandbox/multimodule/foundation/client/support/LuckyIdCodec.java

Diff revisions: vs.
Revision Author Commited Message
948 Diff Diff GeorgeS picture GeorgeS Sat 07 Jun, 2014 23:42:39 +0000

Jusefuls Formatter Updated to New Code Format

541 GeorgeS picture GeorgeS Mon 03 Oct, 2011 04:25:50 +0000