Package io.csar

Interface ConcernRegistry

All Superinterfaces:
Concerned
All Known Implementing Classes:
ConcernRegistryThreadGroup, DefaultConcernRegistry

public interface ConcernRegistry extends Concerned
A registry of concerns.
Author:
Garret Wilson
See Also:
  • Method Details

    • registerConcerns

      default void registerConcerns(@Nonnull Concern... concerns)
      Registers the given concerns, associating them with their respective concern types.
      Implementation Specification:
      The default implementation delegates to registerConcerns(Stream).
      Parameters:
      concerns - The concerns to register.
      See Also:
    • registerConcerns

      default void registerConcerns(@Nonnull Collection<Concern> concerns)
      Registers the given concerns, associating them with their respective concern types.
      Implementation Specification:
      The default implementation delegates to registerConcerns(Stream).
      Parameters:
      concerns - The concerns to register.
      See Also:
    • registerConcerns

      default void registerConcerns(@Nonnull Stream<Concern> concerns)
      Registers the given concerns, associating them with their respective concern types.
      Implementation Specification:
      The default implementation calls registerConcern(Concern) for each indicated concern.
      Parameters:
      concerns - The concerns to register.
      See Also:
    • registerConcern

      default <C extends Concern, D extends Concern> Optional<D> registerConcern(@Nonnull C concern)
      Registers the given concern, associating it with its concern type.
      Implementation Specification:
      The default implementation delegates to registerConcern(Class, Concern).
      Type Parameters:
      C - The type of concern being registered.
      D - The type of concern previously registered.
      Parameters:
      concern - The concern to register.
      Returns:
      The concern previously associated with the same concern type.
      Throws:
      NullPointerException - if the given concern is null.
      ClassCastException - if the concern to be registered is not an instance of its own Concern.getConcernType().
      See Also:
    • registerConcern

      <T extends Concern, C extends T> Optional<T> registerConcern(@Nonnull Class<T> concernType, @Nonnull C concern)
      Registers the given concern.
      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.
      Throws:
      NullPointerException - if the given concern is null.
      ClassCastException - if the concern to be registered is not an instance of the given concern type.
    • unregisterConcern

      <T extends Concern> Optional<T> unregisterConcern(@Nonnull Class<T> concernType)
      Unregisters a concern of the given type. If no concern is associated with the specified type, no action occurs.
      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.