public < T > T get ( Key < T > key ) { checkState ( ht ) ; Object o = ht . get ( key ) ; if ( o instanceof Factory < ? > ) { Factory < ? > fac = ( Factory < ? > ) o ; o = fac . make ( this ) ; if ( o instanceof Factory < ? > ) throw new AssertionError ( "T extends Context.Factory" ) ; Assert . check ( ht . get ( key ) == o ) ; } /* The following cast can't fail unless there was * cheating elsewhere, because of the invariant on ht. * Since we found a key of type Key<T>, the value must * be of type T. */ return Context . < T > uncheckedCast ( o ) ; }
Get the value for the key in this context .