@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,11 +22,10 @@ import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* An {@link org.springframework.util.IdGenerator IdGenerator} that uses
|
||||
* {@link SecureRandom} for the initial seed and {@link Random} thereafter
|
||||
* instead of calling {@link UUID#randomUUID()} every time as
|
||||
* {@link org.springframework.util.JdkIdGenerator JdkIdGenerator} does.
|
||||
* This provides a better balance between securely random id's and performance.
|
||||
* An {@link IdGenerator} that uses {@link SecureRandom} for the initial seed and
|
||||
* {@link Random} thereafter, instead of calling {@link UUID#randomUUID()} every
|
||||
* time as {@link org.springframework.util.JdkIdGenerator JdkIdGenerator} does.
|
||||
* This provides a better balance between securely random ids and performance.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @author Rob Winch
|
||||
@@ -45,8 +44,8 @@ public class AlternativeJdkIdGenerator implements IdGenerator {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public UUID generateId() {
|
||||
|
||||
byte[] randomBytes = new byte[16];
|
||||
this.random.nextBytes(randomBytes);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,14 +19,14 @@ package org.springframework.util;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* An IdGenerator that calls {@link java.util.UUID#randomUUID()}.
|
||||
* An {@link IdGenerator} that calls {@link java.util.UUID#randomUUID()}.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 4.2
|
||||
* @since 4.1.5
|
||||
*/
|
||||
public class JdkIdGenerator implements IdGenerator {
|
||||
|
||||
|
||||
@Override
|
||||
public UUID generateId() {
|
||||
return UUID.randomUUID();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,10 +20,10 @@ import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
/**
|
||||
* An simple IdGenerator that starts at 1 and increments by 1 with each call.
|
||||
* A simple {@link IdGenerator} that starts at 1 and increments by 1 with each call.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 4.2
|
||||
* @since 4.1.5
|
||||
*/
|
||||
public class SimpleIdGenerator implements IdGenerator {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user