Package io.github.astrapi69.random
Class SecureRandomBuilder
- java.lang.Object
-
- io.github.astrapi69.random.SecureRandomBuilder
-
public final class SecureRandomBuilder extends java.lang.Object
The classSecureRandomBuilder
builds aSecureRandom
from the given algorithm and provider. If nothing is set the defaultSecureRandom
object with the default algorithm will be build.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_ALGORITHM
The Constant DEFAULT_ALGORITHM
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SecureRandomBuilder
algorithm(java.lang.String algorithm)
Sets the algorithm.java.security.SecureRandom
build()
Builds aSecureRandom
from the given algorithm and provider.static SecureRandomBuilder
getInstance()
Gets an instance ofSecureRandomBuilder
with the default algorithm and providerstatic SecureRandomBuilder
getInstance(java.lang.String algorithm)
Gets an instance ofSecureRandomBuilder
from the given algorithm and providerstatic SecureRandomBuilder
getInstance(java.lang.String algorithm, java.lang.String provider)
Gets an instance ofSecureRandomBuilder
from the given algorithm and providerstatic SecureRandomBuilder
getInstance(java.lang.String algorithm, java.lang.String provider, long seed)
Gets an instance ofSecureRandomBuilder
from the given algorithm and providerstatic SecureRandomBuilder
getInstance(java.lang.String algorithm, java.lang.String provider, java.util.Date seed)
Gets an instance ofSecureRandomBuilder
from the given algorithm and providerSecureRandomBuilder
provider(java.lang.String provider)
Sets the provider.SecureRandomBuilder
seed(long seed)
Sets the seed.
-
-
-
Field Detail
-
DEFAULT_ALGORITHM
public static final java.lang.String DEFAULT_ALGORITHM
The Constant DEFAULT_ALGORITHM- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static SecureRandomBuilder getInstance()
Gets an instance ofSecureRandomBuilder
with the default algorithm and provider- Returns:
- the new
SecureRandomBuilder
object
-
getInstance
public static SecureRandomBuilder getInstance(java.lang.String algorithm)
Gets an instance ofSecureRandomBuilder
from the given algorithm and provider- Parameters:
algorithm
- the algorithm- Returns:
- the new
SecureRandomBuilder
object
-
getInstance
public static SecureRandomBuilder getInstance(java.lang.String algorithm, java.lang.String provider)
Gets an instance ofSecureRandomBuilder
from the given algorithm and provider- Parameters:
algorithm
- the algorithmprovider
- the provider- Returns:
- the new
SecureRandomBuilder
object
-
getInstance
public static SecureRandomBuilder getInstance(java.lang.String algorithm, java.lang.String provider, long seed)
Gets an instance ofSecureRandomBuilder
from the given algorithm and provider- Parameters:
algorithm
- the algorithmprovider
- the providerseed
- the seed- Returns:
- the new
SecureRandomBuilder
object
-
getInstance
public static SecureRandomBuilder getInstance(java.lang.String algorithm, java.lang.String provider, java.util.Date seed)
Gets an instance ofSecureRandomBuilder
from the given algorithm and provider- Parameters:
algorithm
- the algorithmprovider
- the providerseed
- the seed asDate
object- Returns:
- the new
SecureRandomBuilder
object
-
algorithm
public SecureRandomBuilder algorithm(java.lang.String algorithm)
Sets the algorithm.- Parameters:
algorithm
- the algorithm- Returns:
- this
SecureRandomBuilder
object. For chaining.
-
build
public java.security.SecureRandom build()
Builds aSecureRandom
from the given algorithm and provider. If nothing is set the defaultSecureRandom
object with the default algorithm will be build.- Returns:
- the new
SecureRandom
object
-
provider
public SecureRandomBuilder provider(java.lang.String provider)
Sets the provider.- Parameters:
provider
- the provider- Returns:
- this
SecureRandomBuilder
object. For chaining.
-
seed
public SecureRandomBuilder seed(long seed)
Sets the seed.- Parameters:
seed
- the seed- Returns:
- this
SecureRandomBuilder
object. For chaining.
-
-