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 creatingAlgorithmobjects.- Author:
- Martin Lindström (martin@idsec.se), Stefan Santesson (stefan@idsec.se)
-
-
Constructor Summary
Constructors Constructor Description AbstractAlgorithmBuilder(String algorithmUri)Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidassertCorrect()Asserts that all fields have been assigned.Bblacklisted(boolean blacklisted)Sets whether this algorithm is blacklisted.Tbuild()Builds theAlgorithm.protected abstract TcreateAlgorithm(String algorithmUri)Creates theAlgorithminstance.protected TgetAlgorithm()Gets the algorithm instance that is being built.protected abstract BgetBuilder()Gets the current builder instance.BjcaName(String jcaName)Assigns the JCA name.Border(int order)Assigns the algorithm order.
-
-
-
Constructor Detail
-
AbstractAlgorithmBuilder
public AbstractAlgorithmBuilder(String algorithmUri)
Constructor.- Parameters:
algorithmUri- the algorithm URI
-
-
Method Detail
-
build
public T build()
Builds theAlgorithm.If invoked several times the method must return the same object.
- Specified by:
buildin interfaceAlgorithmBuilder<T extends AbstractAlgorithm>- Returns:
- the built object
-
jcaName
public B jcaName(String jcaName)
Assigns the JCA name.- Parameters:
jcaName- the JCA name- Returns:
- the builder
-
order
public B order(int order)
Assigns the algorithm order.- Parameters:
order- the order- Returns:
- the builder
-
blacklisted
public B blacklisted(boolean blacklisted)
Sets whether this algorithm is blacklisted. The default isfalse.- Parameters:
blacklisted- whether this algorithm is blacklisted- Returns:
- the builder
-
assertCorrect
protected void assertCorrect() throws IllegalArgumentExceptionAsserts that all fields have been assigned.- Throws:
IllegalArgumentException- if a required field is missing
-
getBuilder
protected abstract B getBuilder()
Gets the current builder instance.- Returns:
- the builder instance
-
createAlgorithm
protected abstract T createAlgorithm(String algorithmUri)
Creates theAlgorithminstance.- Parameters:
algorithmUri- the algorithm URI- Returns:
- an Algorithm instance
-
getAlgorithm
protected final T getAlgorithm()
Gets the algorithm instance that is being built.- Returns:
- the algorithm instance
-
-