View Javadoc

1   /*
2    * Copyright 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.admin.domain.model;
17  
18  import java.io.Serializable;
19  import java.util.Collection;
20  
21  import de.smartics.properties.api.config.domain.key.ConfigurationKey;
22  import de.smartics.util.lang.Arg;
23  
24  /**
25   * The aggregate of configuration keys.
26   */
27  public final class ConfigurationKeys implements Serializable
28  {
29    // ********************************* Fields *********************************
30  
31    // --- constants ------------------------------------------------------------
32  
33    /**
34     * The class version identifier.
35     * <p>
36     * The value of this constant is {@value}.
37     * </p>
38     */
39    private static final long serialVersionUID = 1L;
40  
41    // --- members --------------------------------------------------------------
42  
43    /**
44     * The application the keys are part of.
45     *
46     * @serial
47     */
48    private final ManagedApplication application;
49  
50    /**
51     * The keys to configurations of the application.
52     *
53     * @serial
54     */
55    private final Collection<ConfigurationKey<?>> keys;
56  
57    // ****************************** Initializer *******************************
58  
59    // ****************************** Constructors ******************************
60  
61    /**
62     * Default constructor.
63     *
64     * @param application the application the keys are part of.
65     * @param keys the keys to configurations of the application.
66     * @throws NullPointerException if {@code application} or {@code keys} is
67     *           <code>null</code>.
68     */
69    public ConfigurationKeys(final ManagedApplication application,
70        final Collection<ConfigurationKey<?>> keys) throws NullPointerException
71    {
72      this.application = Arg.checkNotNull("application", application);
73      this.keys = Arg.checkNotNull("keys", keys);
74    }
75  
76    // ****************************** Inner Classes *****************************
77  
78    // ********************************* Methods ********************************
79  
80    // --- init -----------------------------------------------------------------
81  
82    // --- get&set --------------------------------------------------------------
83  
84    /**
85     * Returns the application the keys are part of.
86     *
87     * @return the application the keys are part of.
88     */
89    public ManagedApplication getApplication()
90    {
91      return application;
92    }
93  
94    /**
95     * Returns the keys to configurations of the application.
96     *
97     * @return the keys to configurations of the application.
98     */
99    public Collection<ConfigurationKey<?>> getKeys()
100   {
101     return keys;
102   }
103 
104   // --- business -------------------------------------------------------------
105 
106   // --- object basics --------------------------------------------------------
107 
108 }