Package io.csar
Class DefaultConcernRegistry
java.lang.Object
io.csar.DefaultConcernRegistry
- All Implemented Interfaces:
Concerned
,ConcernRegistry
Default implementation of a registry of concerns. This class is concurrent thread-safe.
- Author:
- Garret Wilson
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfindConcern
(Class<T> concernType) Returns the concern for the given concern type.registerConcern
(Class<T> concernType, C concern) Registers the given concern.unregisterConcern
(Class<T> concernType) Unregisters a concern of the given type.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.csar.ConcernRegistry
registerConcern, registerConcerns, registerConcerns, registerConcerns
-
Constructor Details
-
DefaultConcernRegistry
public DefaultConcernRegistry()
-
-
Method Details
-
registerConcern
public final <T extends Concern,C extends T> Optional<T> registerConcern(Class<T> concernType, C concern) Description copied from interface:ConcernRegistry
Registers the given concern.- Specified by:
registerConcern
in interfaceConcernRegistry
- Type Parameters:
T
- The registration concern type.C
- The type of concern being registered.- Parameters:
concernType
- The class with which to associate the concern.concern
- The concern to register.- Returns:
- The concern previously associated with the given class.
-
findConcern
Description copied from interface:Concerned
Returns the concern for the given concern type.- Specified by:
findConcern
in interfaceConcerned
- Type Parameters:
T
- The type of concern to retrieve.- Parameters:
concernType
- The class of concern to retrieve.- Returns:
- The concern associated with the given class.
-
unregisterConcern
Description copied from interface:ConcernRegistry
Unregisters a concern of the given type. If no concern is associated with the specified type, no action occurs.- Specified by:
unregisterConcern
in interfaceConcernRegistry
- Type Parameters:
T
- The type of concern being unregistered.- Parameters:
concernType
- The class with which the concern is associated.- Returns:
- The concern previously associated with the given class.
-