View Javadoc

1   /*
2    * Copyright 2004-2005 the original author or authors.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5    * use this file except in compliance with the License. You may obtain a copy of
6    * the License at
7    * 
8    * http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations under
14   * the License.
15   */
16  package net.sf.composite;
17  
18  /***
19   * A composite that can be queried for information about its components.
20   * 
21   * @author Matt Sgarlata
22   * @since Dec 27, 2004
23   */
24  public interface ListableComposite extends Composite {
25  
26  	/***
27  	 * Returns the components that make up this composite that are of the given
28  	 * type.
29  	 * 
30  	 * @param componentType
31  	 *            the type of component for which we are searching
32  	 * @return the components that make up this composite that are of the given
33  	 *         type
34  	 * @throws CompositeException
35  	 *             if an error occurrs
36  	 * @see net.sf.composite.util.ContainerUtils#getElementsOfType(Object[], Class)
37  	 */
38  	public Object[] getComponentsOfType(Class componentType)
39  		throws CompositeException;
40  
41  	/***
42  	 * Indicates whether one or more components of the given type make up this
43  	 * composite.
44  	 * 
45  	 * @param componentType
46  	 *            the type of component for which we are searching
47  	 * @return <code>true</code> if one or more of the components of the given
48  	 *         type make up this composite or <br>
49  	 *         <code>false</code>, otherwise
50  	 * @throws CompositeException
51  	 *             if an error occurrs
52  	 */
53  	public boolean containsComponentOfType(Class componentType)
54  		throws CompositeException;
55  
56  }