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.key;
17  
18  import java.io.Serializable;
19  
20  /**
21   * The configuration key identifies a configuration. With this key all
22   * configuration values can be accessed by their local configuration keys.
23   *
24   * @param <T> the implementing type of this interface.
25   */
26  public interface ConfigurationKey<T extends ConfigurationKey<?>> extends
27      Serializable, Comparable<T>
28  {
29  
30    /**
31     * Returns <code>true</code> if this key instance has active dynamic parts.
32     * Returns <code>false</code> (otherwise) if this key instance has only static
33     * parts. The decision criteria between a static and a dynamic key is, if all
34     * keys are known at startup, or if keys have dynamic parts, like the current
35     * user or the current tenant which can change during runtime.
36     *
37     * @return <code>true</code> when this key uses dynamic parts (and not only
38     *         static parts). <code>false</code> otherwise.
39     */
40    boolean hasActiveDynamicParts();
41  
42    /**
43     * Returns the hash code of the object.
44     *
45     * @return the hash code.
46     */
47    int hashCode();
48  
49    /**
50     * Returns <code>true</code> if the given object is semantically equal to the
51     * given object, <code>false</code> otherwise.
52     *
53     * @param object the instance to compare to.
54     * @return <code>true</code> if the given object is semantically equal to the
55     *         given object, <code>false</code> otherwise.
56     */
57    boolean equals(Object object);
58  
59    @Override
60    int compareTo(T o);
61  
62    /**
63     * Returns the string representation of the object.
64     *
65     * @return the string representation of the object.
66     */
67    String toString();
68  
69  }