1 | |
package org.kuali.spring.util; |
2 | |
|
3 | |
import org.springframework.util.StringValueResolver; |
4 | |
|
5 | |
public class DefaultStringValueResolver implements StringValueResolver { |
6 | |
PlaceholderStringResolver resolver; |
7 | |
ValueRetriever retriever; |
8 | |
String nullValue; |
9 | |
|
10 | |
public DefaultStringValueResolver() { |
11 | 1 | this(null, null, null); |
12 | 1 | } |
13 | |
|
14 | |
public DefaultStringValueResolver(PlaceholderStringResolver resolver, ValueRetriever retriever, String nullValue) { |
15 | 1 | super(); |
16 | 1 | this.resolver = resolver; |
17 | 1 | this.retriever = retriever; |
18 | 1 | this.nullValue = nullValue; |
19 | 1 | } |
20 | |
|
21 | |
@Override |
22 | |
public String resolveStringValue(String strVal) { |
23 | 38 | String value = resolver.resolve(strVal, retriever); |
24 | 38 | return value.equals(nullValue) ? null : value; |
25 | |
} |
26 | |
|
27 | |
public ValueRetriever getRetriever() { |
28 | 0 | return retriever; |
29 | |
} |
30 | |
|
31 | |
public void setRetriever(ValueRetriever resolver) { |
32 | 1 | this.retriever = resolver; |
33 | 1 | } |
34 | |
|
35 | |
public String getNullValue() { |
36 | 0 | return nullValue; |
37 | |
} |
38 | |
|
39 | |
public void setNullValue(String nullValue) { |
40 | 1 | this.nullValue = nullValue; |
41 | 1 | } |
42 | |
|
43 | |
public PlaceholderStringResolver getResolver() { |
44 | 0 | return resolver; |
45 | |
} |
46 | |
|
47 | |
public void setResolver(PlaceholderStringResolver resolver) { |
48 | 1 | this.resolver = resolver; |
49 | 1 | } |
50 | |
|
51 | |
} |