Class AspectMap

java.lang.Object
de.espirit.firstspirit.aspects.AspectMap

public final class AspectMap extends Object
A simple map for type safe aspect mapping.
Since:
4.2.405
  • Constructor Details

    • AspectMap

      public AspectMap()
  • Method Details

    • put

      public final <A, C extends A> void put(@NotNull @NotNull AspectType<A> type, @NotNull C aspect)
      Put an aspect for specific type.

      Example:
      String aspect = ...;
      AspectType<CharSequence> type = ...;
      put(type, aspect);

      Type Parameters:
      A - The type of the aspect.
      C - The concrete implementation type of the aspect.
      Parameters:
      type - The aspect type.
      aspect - The aspect implementation.
      Since:
      4.2.405
    • remove

      public final void remove(AspectType<?> type)
      Remove the aspect for the given type from this map.
      Parameters:
      type - The aspect type.
      Since:
      4.2.405
    • get

      public final <A> A get(AspectType<A> type)
      Get the correctly typed aspect for a type.

      Example
      AspectType<CharSequence> type = ...;
      CharSequence aspect = get(type);

      Type Parameters:
      A - The type of the aspect.
      Parameters:
      type - The aspect type to look up.
      Returns:
      The aspect implementation.
      Since:
      4.2.405