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.resolve; 17 18 import java.io.Serializable; 19 20 import de.smartics.properties.api.config.domain.UnknownPropertyException; 21 import de.smartics.properties.api.config.domain.key.ConfigurationKey; 22 import de.smartics.properties.api.core.domain.PropertyValidationException; 23 24 /** 25 * Provides access to property names to their values. Used for resolver to 26 * resolve placeholders by their values. 27 */ 28 public interface ResolveContext extends Serializable 29 { 30 // ********************************* Fields ********************************* 31 32 // --- constants ------------------------------------------------------------ 33 34 // ****************************** Initializer ******************************* 35 36 // ****************************** Inner Classes ***************************** 37 38 // ********************************* Methods ******************************** 39 40 // --- get&set -------------------------------------------------------------- 41 42 /** 43 * Returns the unique identifier of the wrapped properties configuration. 44 * 45 * @return the unique identifier of the wrapped properties configuration. 46 */ 47 ConfigurationKey<?> getKey(); 48 49 // --- business ------------------------------------------------------------- 50 51 /** 52 * Returns the value for the given key. 53 * 54 * @param key the key to the requested value. 55 * @return the requested value or <code>null</code> if there is no value for 56 * that key (but the key is known). 57 * @throws IllegalArgumentException if {@code key} is blank. 58 * @throws UnknownPropertyException if {@code key} is not known. 59 * @throws PropertyValidationException if the property is invalid according to 60 * its constraints. 61 */ 62 String get(String key) throws IllegalArgumentException, 63 UnknownPropertyException, PropertyValidationException; 64 65 // --- object basics -------------------------------------------------------- 66 }