/** Adds an initialized component to the brewery * under the given name. * @throws RuntimeException if component is null * @throws RuntimeException if name is null */ public void beer(Object component, String name) { Exceptions.checkNotNullParameter(component, "component"); Exceptions.checkNotNullParameter(name, "name"); beers.put(name, component); if (component instanceof Brewable) { ((Brewable)component).brew(this); } if (component instanceof Stoppable) { addStoppable((Stoppable) component); } }