1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  package org.kuali.common.util.service;
17  
18  import java.util.List;
19  
20  import org.kuali.common.util.spring.SpringUtils;
21  import org.springframework.core.env.PropertySource;
22  
23  public class PropertySourceContext {
24  
25  	public static final boolean DEFAULT_REMOVE_EXISTING_SOURCES = false;
26  	public static final boolean DEFAULT_LAST_ONE_IN_WINS = true;
27  	public static final PropertySourceAddPriority DEFAULT_PRIORITY = PropertySourceAddPriority.LAST;
28  
29  	
30  	boolean removeExistingSources = DEFAULT_REMOVE_EXISTING_SOURCES;
31  
32  	
33  	
34  	boolean lastOneInWins = DEFAULT_LAST_ONE_IN_WINS;
35  
36  	
37  	PropertySourceAddPriority priority = DEFAULT_PRIORITY;
38  
39  	
40  	List<PropertySource<?>> sources;
41  
42  	public PropertySourceContext() {
43  		this(null);
44  	}
45  
46  	public PropertySourceContext(List<PropertySource<?>> sources) {
47  		this(sources, DEFAULT_REMOVE_EXISTING_SOURCES);
48  	}
49  
50  	public PropertySourceContext(PropertySource<?> source, boolean removeExistingSources) {
51  		this(SpringUtils.asList(source), removeExistingSources);
52  	}
53  
54  	public PropertySourceContext(List<PropertySource<?>> sources, boolean removeExistingSources) {
55  		super();
56  		this.sources = sources;
57  		this.removeExistingSources = removeExistingSources;
58  	}
59  
60  	public boolean isRemoveExistingSources() {
61  		return removeExistingSources;
62  	}
63  
64  	public void setRemoveExistingSources(boolean removeExistingSources) {
65  		this.removeExistingSources = removeExistingSources;
66  	}
67  
68  	public boolean isLastOneInWins() {
69  		return lastOneInWins;
70  	}
71  
72  	public void setLastOneInWins(boolean lastOneInWins) {
73  		this.lastOneInWins = lastOneInWins;
74  	}
75  
76  	public List<PropertySource<?>> getSources() {
77  		return sources;
78  	}
79  
80  	public void setSources(List<PropertySource<?>> sources) {
81  		this.sources = sources;
82  	}
83  
84  	public PropertySourceAddPriority getPriority() {
85  		return priority;
86  	}
87  
88  	public void setPriority(PropertySourceAddPriority priority) {
89  		this.priority = priority;
90  	}
91  
92  }