protected < T > T getScopedObject ( final Key < T > key , final Provider < T > unscoped , final Map < Key < ? > , Object > scopeMap ) { // ok, because we know what we'd put in before @ SuppressWarnings ( "unchecked" ) T value = ( T ) scopeMap . get ( key ) ; if ( value == null ) { /* * no cache instance present, so we use the one we get from the unscoped provider and * add it to the cache */ value = unscoped . get ( ) ; scopeMap . put ( key , value ) ; } return value ; }
If already present gets the object for the specified key from the scope map . Otherwise it is retrieved from the unscoped provider and stored in the scope map .