All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.kuali.common.util.service.PropertySourceContext Maven / Gradle / Ivy

There is a newer version: 4.4.17
Show newest version
/**
 * Copyright 2010-2014 The Kuali Foundation
 *
 * Licensed under the Educational Community License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.opensource.org/licenses/ecl2.php
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.kuali.common.util.service;

import java.util.List;

import org.kuali.common.util.spring.SpringUtils;
import org.springframework.core.env.PropertySource;

@Deprecated
public class PropertySourceContext {

	public static final boolean DEFAULT_REMOVE_EXISTING_SOURCES = false;
	public static final boolean DEFAULT_LAST_ONE_IN_WINS = true;
	public static final PropertySourceAddPriority DEFAULT_PRIORITY = PropertySourceAddPriority.LAST;

	// If true, any existing property sources are removed and replaced by the list from this context
	boolean removeExistingSources = DEFAULT_REMOVE_EXISTING_SOURCES;

	// If true, the last PropertySource in the list has the highest priority
	// That is to say, Spring will search for property values starting at the bottom of the list and work its way upwards, stopping as soon as it has a match
	boolean lastOneInWins = DEFAULT_LAST_ONE_IN_WINS;

	// Can add property sources before or after existing property sources
	PropertySourceAddPriority priority = DEFAULT_PRIORITY;

	// The list of property source objects to add to the environment
	List> sources;

	public PropertySourceContext() {
		this(null);
	}

	public PropertySourceContext(List> sources) {
		this(sources, DEFAULT_REMOVE_EXISTING_SOURCES);
	}

	public PropertySourceContext(PropertySource source, boolean removeExistingSources) {
		this(SpringUtils.asList(source), removeExistingSources);
	}

	public PropertySourceContext(List> sources, boolean removeExistingSources) {
		super();
		this.sources = sources;
		this.removeExistingSources = removeExistingSources;
	}

	public boolean isRemoveExistingSources() {
		return removeExistingSources;
	}

	public void setRemoveExistingSources(boolean removeExistingSources) {
		this.removeExistingSources = removeExistingSources;
	}

	public boolean isLastOneInWins() {
		return lastOneInWins;
	}

	public void setLastOneInWins(boolean lastOneInWins) {
		this.lastOneInWins = lastOneInWins;
	}

	public List> getSources() {
		return sources;
	}

	public void setSources(List> sources) {
		this.sources = sources;
	}

	public PropertySourceAddPriority getPriority() {
		return priority;
	}

	public void setPriority(PropertySourceAddPriority priority) {
		this.priority = priority;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy