org.eclipse.jetty.util.component.Container Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jetty-util Show documentation
Show all versions of jetty-util Show documentation
Utility classes for Jetty
//
// ========================================================================
// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others.
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License v. 2.0 which is available at
// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
// which is available at https://www.apache.org/licenses/LICENSE-2.0.
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
// ========================================================================
//
package org.eclipse.jetty.util.component;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.EventListener;
import java.util.List;
/**
* A Container
*/
public interface Container
{
/**
* Add a bean. If the bean is-a {@link EventListener}, then also do an implicit {@link #addEventListener(EventListener)}.
*
* @param o the bean object to add
* @return true if the bean was added, false if it was already present
*/
boolean addBean(Object o);
/**
* Adds the given bean, explicitly managing it or not.
* If the bean is-a {@link EventListener}, then also do an implicit {@link #addEventListener(EventListener)}.
* @param o The bean object to add
* @param managed whether to managed the lifecycle of the bean
* @return true if the bean was added, false if it was already present
*/
boolean addBean(Object o, boolean managed);
/**
* @return the collection of beans known to this aggregate, in the order they were added.
*/
Collection