Package de.alpharogroup.random
Class SecureRandomBuilder
- java.lang.Object
-
- de.alpharogroup.random.SecureRandomBuilder
-
public final class SecureRandomBuilder extends java.lang.ObjectThe classSecureRandomBuilderbuilds aSecureRandomfrom the given algorithm and provider. If nothing is set the defaultSecureRandomobject with the default algorithm will be build.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_ALGORITHMThe Constant DEFAULT_ALGORITHM
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SecureRandomBuilderalgorithm(java.lang.String algorithm)Sets the algorithm.java.security.SecureRandombuild()Builds aSecureRandomfrom the given algorithm and provider.static SecureRandomBuildergetInstance()Gets an instance ofSecureRandomBuilderwith the default algorithm and providerstatic SecureRandomBuildergetInstance(java.lang.String algorithm)Gets an instance ofSecureRandomBuilderfrom the given algorithm and providerstatic SecureRandomBuildergetInstance(java.lang.String algorithm, java.lang.String provider)Gets an instance ofSecureRandomBuilderfrom the given algorithm and providerstatic SecureRandomBuildergetInstance(java.lang.String algorithm, java.lang.String provider, long seed)Gets an instance ofSecureRandomBuilderfrom the given algorithm and providerSecureRandomBuilderprovider(java.lang.String provider)Sets the provider.SecureRandomBuilderseed(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 ofSecureRandomBuilderwith the default algorithm and provider- Returns:
- the new
SecureRandomBuilderobject
-
getInstance
public static SecureRandomBuilder getInstance(java.lang.String algorithm)
Gets an instance ofSecureRandomBuilderfrom the given algorithm and provider- Parameters:
algorithm- the algorithm- Returns:
- the new
SecureRandomBuilderobject
-
getInstance
public static SecureRandomBuilder getInstance(java.lang.String algorithm, java.lang.String provider)
Gets an instance ofSecureRandomBuilderfrom the given algorithm and provider- Parameters:
algorithm- the algorithmprovider- the provider- Returns:
- the new
SecureRandomBuilderobject
-
getInstance
public static SecureRandomBuilder getInstance(java.lang.String algorithm, java.lang.String provider, long seed)
Gets an instance ofSecureRandomBuilderfrom the given algorithm and provider- Parameters:
algorithm- the algorithmprovider- the providerseed- the seed- Returns:
- the new
SecureRandomBuilderobject
-
algorithm
public SecureRandomBuilder algorithm(@Nonnull java.lang.String algorithm)
Sets the algorithm.- Parameters:
algorithm- the algorithm- Returns:
- this
SecureRandomBuilderobject. For chaining.
-
build
public java.security.SecureRandom build()
Builds aSecureRandomfrom the given algorithm and provider. If nothing is set the defaultSecureRandomobject with the default algorithm will be build.- Returns:
- the new
SecureRandomobject
-
provider
public SecureRandomBuilder provider(@Nonnull java.lang.String provider)
Sets the provider.- Parameters:
provider- the provider- Returns:
- this
SecureRandomBuilderobject. For chaining.
-
seed
public SecureRandomBuilder seed(long seed)
Sets the seed.- Parameters:
seed- the seed- Returns:
- this
SecureRandomBuilderobject. For chaining.
-
-