Class AlgorithmRegistrySingleton
java.lang.Object
se.swedenconnect.security.algorithms.AlgorithmRegistrySingleton
- All Implemented Interfaces:
AlgorithmRegistry
A singleton for easy access to the
AlgorithmRegistry.- Author:
- Martin Lindström (martin@idsec.se), Stefan Santesson (stefan@idsec.se)
-
Method Summary
Modifier and TypeMethodDescriptiongetAlgorithm(String algorithmUri) Gets the algorithm based on its URI.<T extends Algorithm>
TgetAlgorithm(String algorithmUri, Class<T> clazz) Gets an algorithm based on its URI and type.getAlgorithm(Predicate<Algorithm> predicate) Gets the first algorithm that matches the supplied predicate.<T extends Algorithm>
TgetAlgorithm(Predicate<Algorithm> predicate, Class<T> clazz) Gets the first algorithm that matches the given type and supplied predicate.getAlgorithms(Predicate<Algorithm> predicate) Gets all algorithms that matches the supplied predicate.getAlgorithms(Predicate<Algorithm> predicate, Class<T> clazz) Gets all algorithms that matches the given type and the supplied predicate.static AlgorithmRegistrySingletonGets the singleton instance.static voidsetAlgorithmRegistry(AlgorithmRegistry algorithmRegistry) Assigns theAlgorithmRegistryinstance to be used by this singleton.
-
Method Details
-
getInstance
Gets the singleton instance.- Returns:
- the singleton instance
-
setAlgorithmRegistry
Assigns theAlgorithmRegistryinstance to be used by this singleton. If no instance is assigned, a default implementation of the registry will be used.- Parameters:
algorithmRegistry- the registry to be used by the singleton
-
getAlgorithm
Gets the algorithm based on its URI.- Specified by:
getAlgorithmin interfaceAlgorithmRegistry- Parameters:
algorithmUri- the algorithm URI- Returns:
- the algorithm, or null if none is found
-
getAlgorithm
Gets an algorithm based on its URI and type.- Specified by:
getAlgorithmin interfaceAlgorithmRegistry- Type Parameters:
T- the algorithm type- Parameters:
algorithmUri- the algorithm URIclazz- the type representing the algorithm- Returns:
- the algorithm, or null if none is found
-
getAlgorithm
Gets the first algorithm that matches the supplied predicate.If more than one algorithm matches the supplied predicate, the one with the lowest order is returned.
- Specified by:
getAlgorithmin interfaceAlgorithmRegistry- Parameters:
predicate- the predicate to apply- Returns:
- an Algorithm or null if no algorithms in the registry matches
- See Also:
-
getAlgorithm
Gets the first algorithm that matches the given type and supplied predicate.If more than one algorithm matches the supplied predicate, the one with the lowest order is returned.
- Specified by:
getAlgorithmin interfaceAlgorithmRegistry- Parameters:
predicate- the predicate to applyclazz- the type representing the algorithm- Returns:
- an Algorithm or null if no algorithms in the registry matches
- See Also:
-
getAlgorithms
Gets all algorithms that matches the supplied predicate.The list is sorted with the lowest algorithms with the lowest order index first.
- Specified by:
getAlgorithmsin interfaceAlgorithmRegistry- Parameters:
predicate- the predicate to apply- Returns:
- a (possibly empty) list of Algorithm objects
-
getAlgorithms
Gets all algorithms that matches the given type and the supplied predicate.The list is sorted with the lowest algorithms with the lowest order index first.
- Specified by:
getAlgorithmsin interfaceAlgorithmRegistry- Parameters:
predicate- the predicate to applyclazz- the type representing the algorithm- Returns:
- a (possibly empty) list of Algorithm objects
-