Package io.csar

Interface ConcernRegistry

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default <C extends Concern,​D extends Concern>
      java.util.Optional<D>
      registerConcern​(C concern)
      Registers the given concern, associating it with its concern type.
      <T extends Concern,​C extends T>
      java.util.Optional<T>
      registerConcern​(java.lang.Class<T> concernType, C concern)
      Registers the given concern.
      default void registerConcerns​(Concern... concerns)
      Registers the given concerns, associating them with their respective concern types.
      default void registerConcerns​(java.util.Collection<Concern> concerns)
      Registers the given concerns, associating them with their respective concern types.
      default void registerConcerns​(java.util.stream.Stream<Concern> concerns)
      Registers the given concerns, associating them with their respective concern types.
      <T extends Concern>
      java.util.Optional<T>
      unregisterConcern​(java.lang.Class<T> concernType)
      Unregisters a concern of the given type.
    • Method Detail

      • 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:
        registerConcern(Concern)
      • registerConcerns

        default void registerConcerns​(@Nonnull
                                      java.util.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:
        registerConcern(Concern)
      • registerConcerns

        default void registerConcerns​(@Nonnull
                                      java.util.stream.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(Concern)
      • registerConcern

        default <C extends Concern,​D extends Concern> java.util.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:
        java.lang.NullPointerException - if the given concern is null.
        java.lang.ClassCastException - if the concern to be registered is not an instance of its own Concern.getConcernType().
        See Also:
        Concern.getConcernType(), registerConcern(Class, Concern)
      • registerConcern

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

        <T extends Concern> java.util.Optional<T> unregisterConcern​(@Nonnull
                                                                    java.lang.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.