-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresolver.go
40 lines (29 loc) · 878 Bytes
/
resolver.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package core
type PropertyResolver interface {
ContainsProperty(name string) bool
GetProperty(name string, defaultValue string) interface{}
}
type SimplePropertyResolver struct {
sources *PropertySources
}
func NewSimplePropertyResolver(sources *PropertySources) *SimplePropertyResolver {
return &SimplePropertyResolver{
sources,
}
}
func (resolver *SimplePropertyResolver) ContainsProperty(name string) bool {
for _, propertySource := range resolver.sources.GetPropertyResources() {
if propertySource.ContainsProperty(name) {
return true
}
}
return false
}
func (resolver *SimplePropertyResolver) GetProperty(name string, defaultValue string) interface{} {
for _, propertySource := range resolver.sources.GetPropertyResources() {
if propertySource.ContainsProperty(name) {
return propertySource.GetProperty(name)
}
}
return defaultValue
}