class RestrictedComponentContainer extends AbstractComponentContainer {

  @Override
  public <T> T get(Class<T> anInterface) {
    if (!allowedDirectInterfaces.contains(anInterface)) {
      throw new IllegalArgumentException(
          String.format("Attempting to request an undeclared dependency %s.", anInterface));
    }

    // The container is guaranteed to contain a class keyed with Publisher.class. This is what we
    // want to restrict access to, if anyone wants to register their own Component that for whatever
    // reason implements Publisher, we don't want to interfere with it. Hence the equals check and
    // not Publisher.class.isAssignableFrom(anTnterface)
    T value = delegateContainer.get(anInterface);
    if (!anInterface.equals(Publisher.class)) {
      return value;
    }

    @SuppressWarnings("unchecked")
    T publisher = (T) new RestrictedPublisher(allowedPublishedEvents, (Publisher) value);
    return publisher;
  }

    RestrictedComponentContainer(Component<?> component, ComponentContainer container);

}