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 Details

    • AbstractAlgorithmBuilder

      public AbstractAlgorithmBuilder(String algorithmUri)
      Constructor.
      Parameters:
      algorithmUri - the algorithm URI
  • Method Details

    • build

      public T build()
      Builds the Algorithm.

      If invoked several times the method must return the same object.

      Specified by:
      build in interface AlgorithmBuilder<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 is false.
      Parameters:
      blacklisted - whether this algorithm is blacklisted
      Returns:
      the builder
    • assertCorrect

      protected void assertCorrect() throws IllegalArgumentException
      Asserts 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 the Algorithm instance.
      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