View Javadoc

1   /*
2    * Copyright 2010-2013 smartics, Kronseder & Reiner GmbH
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of 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,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package de.smartics.testdoc.report.index;
17  
18  import java.io.Serializable;
19  import java.util.List;
20  import java.util.Map;
21  
22  import net.jcip.annotations.NotThreadSafe;
23  
24  /**
25   * A section defines a collection of items that are grouped by a set of defined
26   * criteria.
27   *
28   * @param <T> the type of the items added to this section.
29   * @author <a href="mailto:robert.reiner@smartics.de">Robert Reiner</a>
30   * @version $Revision:591 $
31   */
32  @NotThreadSafe
33  public interface Section<T extends Serializable> extends Serializable
34  {
35    // ********************************* Fields *********************************
36  
37    // --- constants ------------------------------------------------------------
38  
39    // ****************************** Initializer *******************************
40  
41    // ****************************** Inner Classes *****************************
42  
43    // ********************************* Methods ********************************
44  
45    // --- get&set --------------------------------------------------------------
46  
47    /**
48     * Returns the name of this section.
49     *
50     * @return the name of this section.
51     */
52    String getName();
53  
54    /**
55     * Returns the properties associated with this section.
56     *
57     * @return the properties associated with this section.
58     */
59    Map<String, ? extends Serializable> getProperties();
60  
61    // --- business -------------------------------------------------------------
62  
63    // --- business -------------------------------------------------------------
64  
65    /**
66     * Adds the given sub section to this section.
67     *
68     * @param subSection the section to be added as sub section to this section.
69     */
70    void addSubSection(Section<T> subSection);
71  
72    /**
73     * Returns the list of sub sections to this section.
74     *
75     * @return the list of sub sections to this section. The returned value is
76     *         never <code>null</code>.
77     */
78    List<Section<T>> getSubSections();
79  
80    /**
81     * Adds the given item to this section.
82     *
83     * @param item the item to be added to this section.
84     */
85    void addItem(T item);
86  
87    /**
88     * Returns the list of items associated with this section.
89     *
90     * @return the list of items associated with this section. The returned value
91     *         is never <code>null</code>.
92     */
93    List<T> getItems();
94  
95    /**
96     * Checks if this section or any sub sections contains at least one item.
97     *
98     * @return <code>true</code> if at least on item is contained,
99     *         <code>false</code> if no item is contained.
100    */
101   boolean isEmpty();
102 
103   /**
104    * Checks if the given section contains sub sections.
105    *
106    * @return <code>true</code> if at least on sub section is contained,
107    *         <code>false</code> otherwise.
108    */
109   boolean containsSubSections();
110 
111   // --- object basics --------------------------------------------------------
112 
113 }