Class NamedCurveRegistryImpl
- java.lang.Object
-
- se.swedenconnect.security.algorithms.curves.NamedCurveRegistryImpl
-
- All Implemented Interfaces:
NamedCurveRegistry
- Direct Known Subclasses:
StaticNamedCurveRegistry
public class NamedCurveRegistryImpl extends Object implements NamedCurveRegistry
Implementation of theNamedCurveRegistryinterface.- Author:
- Martin Lindström (martin@idsec.se), Stefan Santesson (stefan@idsec.se)
-
-
Constructor Summary
Constructors Constructor Description NamedCurveRegistryImpl()Default constructor.NamedCurveRegistryImpl(List<NamedCurve> registry)Constructor setting up the registry according to the supplied list.
-
Method Summary
All 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.voidregister(NamedCurve curve)Registers the given curve in the registry.voidunregister(String name)Removes the given curve from the registry.
-
-
-
Constructor Detail
-
NamedCurveRegistryImpl
public NamedCurveRegistryImpl()
Default constructor.
-
NamedCurveRegistryImpl
public NamedCurveRegistryImpl(List<NamedCurve> registry)
Constructor setting up the registry according to the supplied list.Note: a copy of the supplied registry is made.
- Parameters:
registry- initial contents of the registry
-
-
Method Detail
-
register
public void register(NamedCurve curve)
Registers the given curve in the registry.- Parameters:
curve- the curve to register
-
unregister
public void unregister(String name)
Removes the given curve from the registry.- Parameters:
name- the curve name
-
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
-
-