Class NamedCurveRegistrySingleton
- java.lang.Object
-
- se.swedenconnect.security.algorithms.curves.NamedCurveRegistrySingleton
-
- All Implemented Interfaces:
NamedCurveRegistry
public class NamedCurveRegistrySingleton extends Object implements NamedCurveRegistry
An singleton for easy access to theNamedCurveRegistry.- Author:
- Martin Lindström (martin@idsec.se), Stefan Santesson (stefan@idsec.se)
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description NamedCurvegetCurve(String name)Gets aNamedCurvebased on its name.NamedCurvegetCurve(Predicate<NamedCurve> predicate)Gets aNamedCurvebased on the given predicate.List<NamedCurve>getCurves(Predicate<NamedCurve> predicate)Gets all curves that matches the given predicate.static NamedCurveRegistrySingletongetInstance()Gets the singleton instance.static voidsetAlgorithmRegistry(NamedCurveRegistry registry)Assigns theNamedCurveRegistryinstance to be used by this singleton.
-
-
-
Method Detail
-
getInstance
public static NamedCurveRegistrySingleton getInstance()
Gets the singleton instance.- Returns:
- the singleton instance
-
setAlgorithmRegistry
public static void setAlgorithmRegistry(NamedCurveRegistry registry)
Assigns theNamedCurveRegistryinstance 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 aNamedCurvebased on its name.- Specified by:
getCurvein interfaceNamedCurveRegistry- Parameters:
name- the name- Returns:
- the NamedCurve or null if no match is found
-
getCurve
public NamedCurve getCurve(Predicate<NamedCurve> predicate)
Gets aNamedCurvebased on the given predicate.- Specified by:
getCurvein interfaceNamedCurveRegistry- 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:
getCurvesin interfaceNamedCurveRegistry- Parameters:
predicate- the predicate- Returns:
- a (possibly empty) list of NamedCurve objects
-
-