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; 17 18 import javax.annotation.CheckForNull; 19 20 /** 21 * Defines a source for properties with read and write access. 22 * 23 * @see PropertyProvider 24 * @see PropertyManager 25 */ 26 public interface PropertySource extends PropertyProvider 27 { 28 // ********************************* Fields ********************************* 29 30 // --- constants ------------------------------------------------------------ 31 32 // ****************************** Initializer ******************************* 33 34 // ****************************** Inner Classes ***************************** 35 36 // ********************************* Methods ******************************** 37 38 // --- get&set -------------------------------------------------------------- 39 40 // --- business ------------------------------------------------------------- 41 42 /** 43 * Sets the property with the given {@code name} to the given {@code value}. 44 * 45 * @param property the property to be set. 46 * @return the old property or <code>null</code> if it either was not set or 47 * had the value <code>null</code>. 48 * @throws NullPointerException if {@code property} is <code>null</code>. 49 */ 50 @CheckForNull 51 Property setProperty(Property property) throws NullPointerException; 52 53 /** 54 * Removes a property making it unknown to the system. If only the value 55 * should be set to <code>null</code> use 56 * {@link #setProperty(Property)}. 57 * 58 * @param name the name of the property to be removed. 59 * @return the old value of the property. 60 * @throws NullPointerException if {@code name} is <code>null</code>. 61 */ 62 @CheckForNull 63 Property removeProperty(String name) throws NullPointerException; 64 65 // --- object basics -------------------------------------------------------- 66 67 }