FileDocCategorySizeDatePackage
UuidUtilPadded.javaAPI DocGlassfish v2 API3423Fri May 04 22:35:32 BST 2007com.sun.enterprise.util.uuid

UuidUtilPadded

public class UuidUtilPadded extends UuidUtil
author
lwhite

Fields Summary
static final int
DESIRED_UUID_LENGTH
Constructors Summary
Methods Summary
public static java.lang.StringgenerateUuid(java.lang.Object obj, int inputLength)

    
    //this method can take in the session object
    //and insure better uniqueness guarantees
    //needed length must be greater than not less than
    //expected returned lengths - i.e. at least 40
           
        int desiredLength = 
            DESIRED_UUID_LENGTH >= inputLength ? DESIRED_UUID_LENGTH:inputLength;
        String unpaddedUuid = UuidUtil.generateUuid(obj);
        StringBuffer sb = new StringBuffer(unpaddedUuid);
        int neededPadding = desiredLength - unpaddedUuid.length();
        //int neededPadding = DESIRED_UUID_LENGTH - unpaddedUuid.length();
        if(neededPadding > 0) {
            for(int i=0; i<neededPadding; i++) {
                sb.append("F");
            }
        }
        return sb.toString();
    
public static voidmain(java.lang.String[] args)
Method main

param
args
audience

        System.out.println(UuidUtilPadded.generateUuidMM());
        System.out.println(UuidUtilPadded.generateUuid());
        System.out.println(UuidUtilPadded.generateUuid(new Object()));
        System.out.println(UuidUtilPadded.generateUuid(new Object(), 40));