⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uuidfactory.java

📁 dspace 用j2ee架构的一个数字图书馆.开源程序
💻 JAVA
字号:
/******************************************************************************
 * DSPACE DIDL MODULE UUID GENERATOR
 * AUTHOR
 *        Los Alamos National Laboratory
 *        Research Library
 *        Digital Library Research & Prototyping Team
 *        Henry Jerez
 *        2004, 2005
 *CONTACT
 *   proto@gws.lanl.gov
 *VERSION
 *  Beta 1
 *  date 07/26/2005 
 * ACKNOWLEDGMENT
 *    Development of this code is part of the aDORe repository project by the Research Library of the Los Alamos National Laboratory.
* BASED ON:
 *Implementation of UUID version 4 (the one that uses random/pseudo-random
 * numbers) 
 * By: Ashraf Amrou
 * Old Dominion University
 * Aug 14, 2003
 *****************************************************************************/
package org.dspace.app.didl;

import java.security.SecureRandom;
import java.util.Random;
/**
 * Factory class for generating UUID version 4. All what this class does is
 * creating UUID version 4 objects using crypto-quality random numbers.
 *
 **/
public final class UUIDFactory{
    
    /**
     * Random number generator
     **/
    private java.util.Random rand = null;
    /**
     *  an instance
     **/
    private static UUIDFactory generator = new UUIDFactory();
    ///////////////////////////////////////////////////    
    /**
     * private constructor (Singleton class)
     **/
    private UUIDFactory() {
        // crypto-quality random number generator
        rand = new SecureRandom();
    }
    ///////////////////////////////////////////////////
    /**
     * Customers of this class call this method to generete new UUID objects
     **/
    public synchronized static UUID generateUUID(){
        return new UUID(generator.rand.nextLong(),generator.rand.nextLong());
    }
    ///////////////////////////////////////////////////
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -