de.espirit.firstspirit.aspects
Class AspectMap

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

public final class AspectMap
extends Object

A simple map for type safe aspect mapping.

Since:
4.2.405

Constructor Summary
AspectMap()
           
 
Method Summary
<A> A
get(AspectType<A> type)
          Get the correctly typed aspect for a type.
<A,C extends A>
void
put(AspectType<A> type, C aspect)
          Put an aspect for specific type.
 void remove(AspectType<?> type)
          Remove the aspect for the given type from this map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AspectMap

public AspectMap()
Method Detail

put

public final <A,C extends A> void put(@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


Copyright © 2012 e-Spirit AG. All Rights Reserved. Build 4.2.480