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.impl.config.domain.key.envapp;
17  
18  import de.smartics.properties.api.config.domain.key.ApplicationId;
19  import de.smartics.properties.api.config.domain.key.EnvironmentId;
20  
21  /**
22   * The configuration key identifies a configuration with environment and
23   * application information. With this key all configuration values can be
24   * accessed by their local configuration keys.
25   */
26  public final class EnvAppConfigurationKey extends
27      AbstractConfigurationKey<EnvAppConfigurationKey>
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    // ****************************** Initializer *******************************
44  
45    // ****************************** Constructors ******************************
46  
47    /**
48     * Default constructor.
49     *
50     * @param applicationId the identifier of the application whose configuration
51     *          is requested.
52     * @param environmentId the identifier of the environment the application is
53     *          deployed in.
54     * @throws NullPointerException if {@code applicationId} or
55     *           {@code environmentId} is <code>null</code>.
56     */
57    public EnvAppConfigurationKey(final EnvironmentId environmentId,
58        final ApplicationId applicationId) throws NullPointerException
59    {
60      super(environmentId, applicationId);
61    }
62  
63    /**
64     * Copy constructor.
65     *
66     * @param key the key to copy.
67     * @param appId the appId to set into the copy.
68     * @throws NullPointerException if {@code key} or {@code appId} is
69     *           <code>null</code>.
70     */
71    public EnvAppConfigurationKey(final EnvAppConfigurationKey key,
72        final ApplicationId appId) throws NullPointerException
73    {
74      this(key.getEnvironmentId(), appId);
75    }
76  
77    // ****************************** Inner Classes *****************************
78  
79    // ********************************* Methods ********************************
80  
81    // --- init -----------------------------------------------------------------
82  
83    // --- get&set --------------------------------------------------------------
84  
85    // --- business -------------------------------------------------------------
86  
87    // --- object basics --------------------------------------------------------
88  
89    /**
90     * Returns the string representation of the object.
91     *
92     * @return the string representation of the object.
93     */
94    @Override
95    public String toString()
96    {
97      final StringBuilder buffer = new StringBuilder(super.toString());
98  
99      return buffer.toString();
100   }
101 }