Class AbstractAlgorithm.AbstractAlgorithmBuilder<T extends AbstractAlgorithm,B extends AlgorithmBuilder<T>>
java.lang.Object
se.swedenconnect.security.algorithms.impl.AbstractAlgorithm.AbstractAlgorithmBuilder<T,B>
- All Implemented Interfaces:
AlgorithmBuilder<T>
- Direct Known Subclasses:
AbstractJoseAlgorithm.AbstractJoseAlgorithmBuilder
,MessageDigestAlgorithmImpl.MessageDigestAlgorithmBuilder
- Enclosing class:
AbstractAlgorithm
protected abstract static class AbstractAlgorithm.AbstractAlgorithmBuilder<T extends AbstractAlgorithm,B extends AlgorithmBuilder<T>>
extends Object
implements AlgorithmBuilder<T>
Abstract builder for creating
Algorithm
objects.- Author:
- Martin Lindström (martin@idsec.se), Stefan Santesson (stefan@idsec.se)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Asserts that all fields have been assigned.blacklisted
(boolean blacklisted) Sets whether this algorithm is blacklisted.build()
Builds theAlgorithm
.protected abstract T
createAlgorithm
(String algorithmUri) Creates theAlgorithm
instance.protected final T
Gets the algorithm instance that is being built.protected abstract B
Gets the current builder instance.Assigns the JCA name.order
(int order) Assigns the algorithm order.
-
Constructor Details
-
AbstractAlgorithmBuilder
Constructor.- Parameters:
algorithmUri
- the algorithm URI
-
-
Method Details
-
build
Builds theAlgorithm
.If invoked several times the method must return the same object.
- Specified by:
build
in interfaceAlgorithmBuilder<T extends AbstractAlgorithm>
- Returns:
- the built object
-
jcaName
Assigns the JCA name.- Parameters:
jcaName
- the JCA name- Returns:
- the builder
-
order
Assigns the algorithm order.- Parameters:
order
- the order- Returns:
- the builder
-
blacklisted
Sets whether this algorithm is blacklisted. The default isfalse
.- Parameters:
blacklisted
- whether this algorithm is blacklisted- Returns:
- the builder
-
assertCorrect
Asserts that all fields have been assigned.- Throws:
IllegalArgumentException
- if a required field is missing
-
getBuilder
Gets the current builder instance.- Returns:
- the builder instance
-
createAlgorithm
Creates theAlgorithm
instance.- Parameters:
algorithmUri
- the algorithm URI- Returns:
- an Algorithm instance
-
getAlgorithm
Gets the algorithm instance that is being built.- Returns:
- the algorithm instance
-