Package de.espirit.firstspirit.aspects
Class AspectMap
java.lang.Object
de.espirit.firstspirit.aspects.AspectMap
A simple map for type safe aspect mapping.
- Since:
- 4.2.405
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal <A> A
get
(AspectType<A> type) Get the correctly typed aspect for a type.final <A,
C extends A>
voidput
(@NotNull AspectType<A> type, C aspect) Put an aspect for specific type.final void
remove
(AspectType<?> type) Remove the aspect for the given type from this map.
-
Constructor Details
-
AspectMap
public AspectMap()
-
-
Method Details
-
put
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
Remove the aspect for the given type from this map.- Parameters:
type
- The aspect type.- Since:
- 4.2.405
-
get
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
-