Package io.csar

Class DefaultConcernRegistry

java.lang.Object
io.csar.DefaultConcernRegistry
All Implemented Interfaces:
Concerned, ConcernRegistry

public class DefaultConcernRegistry extends Object implements ConcernRegistry
Default implementation of a registry of concerns. This class is concurrent thread-safe.
Author:
Garret Wilson
See Also:
  • 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 interface ConcernRegistry
      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

      public <T extends Concern> Optional<T> findConcern(Class<T> concernType)
      Description copied from interface: Concerned
      Returns the concern for the given concern type.
      Specified by:
      findConcern in interface Concerned
      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

      public <T extends Concern> Optional<T> unregisterConcern(Class<T> concernType)
      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 interface ConcernRegistry
      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.