View Javadoc

1   /*
2    * Copyright 2012-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.properties.api.config.domain;
17  
18  import java.beans.PropertyChangeListener;
19  
20  /**
21   * Provides means to manage properties. In addition to reading a writing
22   * properties, implementations of this interface also allow to add and remove
23   * listeners to track changes.
24   *
25   * @see PropertyProvider
26   * @see PropertySource
27   */
28  public interface PropertyManager extends PropertySource
29  {
30    // ********************************* Fields *********************************
31  
32    // --- constants ------------------------------------------------------------
33  
34    // ****************************** Initializer *******************************
35  
36    // ****************************** Inner Classes *****************************
37  
38    // ********************************* Methods ********************************
39  
40    // --- get&set --------------------------------------------------------------
41  
42    // --- business -------------------------------------------------------------
43  
44    /**
45     * Adds the given listener as a listener to the given property.
46     *
47     * @param name the name of the property to track changes.
48     * @param listener the listener to add.
49     * @throws NullPointerException if {@code name} or {@code listener} is
50     *           <code>null</code>.
51     */
52    void addPropertyChangeListener(String name, PropertyChangeListener listener)
53      throws NullPointerException;
54  
55    /**
56     * Removes the given listener as a listener to the given property.
57     *
58     * @param name the name of the property to stop tracking changes.
59     * @param listener the listener to remove.
60     * @throws NullPointerException if {@code name} or {@code listener} is
61     *           <code>null</code>.
62     */
63    void removePropertyChangeListener(String name, PropertyChangeListener listener)
64      throws NullPointerException;
65  
66    /**
67     * Adds the given listener to track any property changes.
68     *
69     * @param listener the listener to add.
70     * @throws NullPointerException if {@code listener} is <code>null</code>.
71     */
72    void addPropertyChangeListener(PropertyChangeListener listener)
73      throws NullPointerException;
74  
75    /**
76     * Removes the given listener to stop tracking property changes.
77     *
78     * @param listener the listener to remove.
79     * @throws NullPointerException if {@code listener} is <code>null</code>.
80     */
81    void removePropertyChangeListener(PropertyChangeListener listener)
82      throws NullPointerException;
83  
84    // --- object basics --------------------------------------------------------
85  
86  }