Class NamedCurveRegistrySingleton

java.lang.Object
se.swedenconnect.security.algorithms.curves.NamedCurveRegistrySingleton
All Implemented Interfaces:
NamedCurveRegistry

public class NamedCurveRegistrySingleton extends Object implements NamedCurveRegistry
A singleton for easy access to the NamedCurveRegistry.
Author:
Martin Lindström (martin@idsec.se), Stefan Santesson (stefan@idsec.se)
  • Method Details

    • getInstance

      public static NamedCurveRegistrySingleton getInstance()
      Gets the singleton instance.
      Returns:
      the singleton instance
    • setAlgorithmRegistry

      public static void setAlgorithmRegistry(NamedCurveRegistry registry)
      Assigns the NamedCurveRegistry instance to be used by this singleton. If no instance is assigned, a default implementation of the registry will be used.
      Parameters:
      registry - the registry to be used by the singleton
    • getCurve

      public NamedCurve getCurve(String name)
      Gets a NamedCurve based on its name.
      Specified by:
      getCurve in interface NamedCurveRegistry
      Parameters:
      name - the name
      Returns:
      the NamedCurve or null if no match is found
    • getCurve

      public NamedCurve getCurve(Predicate<NamedCurve> predicate)
      Gets a NamedCurve based on the given predicate.
      Specified by:
      getCurve in interface NamedCurveRegistry
      Parameters:
      predicate - the predicate
      Returns:
      the first curve that matches the supplied predicate, or null if no matches are found
    • getCurves

      public List<NamedCurve> getCurves(Predicate<NamedCurve> predicate)
      Gets all curves that matches the given predicate.
      Specified by:
      getCurves in interface NamedCurveRegistry
      Parameters:
      predicate - the predicate
      Returns:
      a (possibly empty) list of NamedCurve objects