001/*
002 * Copyright 2002-2014 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.core.env;
018
019import java.util.Map;
020import java.util.Properties;
021
022/**
023 * {@link PropertySource} implementation that extracts properties from a
024 * {@link java.util.Properties} object.
025 *
026 * <p>Note that because a {@code Properties} object is technically an
027 * {@code <Object, Object>} {@link java.util.Hashtable Hashtable}, one may contain
028 * non-{@code String} keys or values. This implementation, however is restricted to
029 * accessing only {@code String}-based keys and values, in the same fashion as
030 * {@link Properties#getProperty} and {@link Properties#setProperty}.
031 *
032 * @author Chris Beams
033 * @author Juergen Hoeller
034 * @since 3.1
035 */
036public class PropertiesPropertySource extends MapPropertySource {
037
038        @SuppressWarnings({"unchecked", "rawtypes"})
039        public PropertiesPropertySource(String name, Properties source) {
040                super(name, (Map) source);
041        }
042
043        protected PropertiesPropertySource(String name, Map<String, Object> source) {
044                super(name, source);
045        }
046
047}