UUIDGenerator 主键产生器

package ?com.newegg.lib;

import ?org.safehaus.uuid.UUIDGenerator;

public ? class ?UUIDImpl? {
????
private?UUIDGenerator?_uuidGenerator?=?UUIDGenerator.getInstance();
????
????
public?String?generate()?{
????????
return?_uuidGenerator.generateRandomBasedUUID().toString();
????}


????
/**?*//**
?????*?
@param?args
?????
*/

????
public?static?void?main(String[]?args)?{
????????
//?TODO?Auto-generated?method?stub
????????UUIDImpl?impl?=?new?UUIDImpl();
????????
for?(int?i?=?0;?i?<?10;?i++)?{
????????????System.out.println(impl.generate());
????????}

????????
????}


}


依赖:
<dependency>
????? <groupid>org.safehaus.jug</groupid>
????? <artifactid>jug</artifactid>
????? <version>2.0.0</version>
??? </dependency>

礼物 2008-09-17 18:34 发表评论

你可能感兴趣的:(generator)