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.spi.config.support;
17  
18  import de.smartics.properties.api.config.domain.ConfigurationProperties;
19  import de.smartics.properties.api.config.domain.SerializableConfigurationProperties;
20  
21  /**
22   * Provides an extended interface to service providers.
23   */
24  public interface ConfigurationPropertiesSpi extends ConfigurationProperties
25  {
26    // ********************************* Fields *********************************
27  
28    // --- constants ------------------------------------------------------------
29  
30    // ****************************** Initializer *******************************
31  
32    // ****************************** Inner Classes *****************************
33  
34    // ********************************* Methods ********************************
35  
36    // --- get&set --------------------------------------------------------------
37  
38    // --- business -------------------------------------------------------------
39  
40    /**
41     * Returns a implementation of the given interface that has access to the
42     * property keys, the property descriptors and the properties itself, when
43     * they are declared in the given interface. The interface must be annotated
44     * with an {@link de.smartics.properties.api.core.annotations.PropertySet}
45     * annotation.
46     * <p>
47     * Allows to pass in a configuration to consult.
48     * </p>
49     *
50     * @param propertiesInterface a
51     *          {@link de.smartics.properties.api.core.annotations.PropertySet}
52     *          annotated interface for which a implementation to access the
53     *          property keys, descriptors and values is requested.
54     * @param configuration the access to the properties. Must not be
55     *          <code>null</code>.
56     * @param <T> type variable to enable a type save return value.
57     * @return a implementation of the given interface to access property
58     *         information.
59     */
60    <T> T getProperties(Class<T> propertiesInterface,
61        SerializableConfigurationProperties configuration);
62  
63    // --- object basics --------------------------------------------------------
64  
65  }