private <T> Key<T> key(Class<T> clss) { checkState(kt); Key<T> k = uncheckedCast(kt.get(clss)); if (k == null) { k = new Key<T>(); kt.put(clss, k); } return k; }
private <T> Key<T> key(Class<T> clss) { checkState(kt); Key<T> k = uncheckedCast(kt.get(clss)); if (k == null) { k = new Key<T>(); kt.put(clss, k); } return k; }
private <T> Key<T> key(Class<T> clss) { checkState(kt); Key<T> k = uncheckedCast(kt.get(clss)); if (k == null) { k = new Key<T>(); kt.put(clss, k); } return k; }
private <T> Key<T> key(Class<T> clss) { checkState(kt); Key<T> k = uncheckedCast(kt.get(clss)); if (k == null) { k = new Key<T>(); kt.put(clss, k); } return k; }
/** Get the value for the key in this context. */ 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(); if (o instanceof Factory) throw new AssertionError("T extends Context.Factory"); assert 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. */ 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(); if (o instanceof Factory) throw new AssertionError("T extends Context.Factory"); assert 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. */ 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. */ 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); }