public class DefaultPropertyPlaceholderResolver extends Object implements PropertyPlaceholderResolver
PropertyPlaceholderResolver
.Modifier and Type | Class and Description |
---|---|
class |
DefaultPropertyPlaceholderResolver.PlaceholderSegment
A segment that represents one or more expressions
that should be searched for in the environment.
|
class |
DefaultPropertyPlaceholderResolver.RawSegment
A segment that represents static text.
|
static interface |
DefaultPropertyPlaceholderResolver.Segment
A segment of placeholder resolution.
|
Modifier and Type | Field and Description |
---|---|
static String |
PREFIX
Prefix for placeholder in properties.
|
static String |
SUFFIX
Suffix for placeholder in properties.
|
Constructor and Description |
---|
DefaultPropertyPlaceholderResolver(PropertyResolver environment)
Deprecated.
|
DefaultPropertyPlaceholderResolver(PropertyResolver environment,
ConversionService conversionService) |
Modifier and Type | Method and Description |
---|---|
List<DefaultPropertyPlaceholderResolver.Segment> |
buildSegments(String str)
Split a placeholder value into logic segments.
|
String |
getPrefix() |
protected <T> T |
resolveExpression(String context,
String expression,
Class<T> type)
Resolves a single expression.
|
Optional<String> |
resolvePlaceholders(String str)
Resolve the placeholders and return an Optional String if it was possible to resolve them.
|
protected boolean |
resolveReplacement(StringBuilder builder,
String str,
String expr)
Deprecated.
No longer used internally. See
resolveExpression(String, String, Class) |
<T> T |
resolveRequiredPlaceholder(String str,
Class<T> type)
Resolves the value of a single placeholder.
|
String |
resolveRequiredPlaceholders(String str)
Resolve the placeholders and return an Optional String if it was possible to resolve them.
|
public static final String PREFIX
public static final String SUFFIX
@Deprecated public DefaultPropertyPlaceholderResolver(PropertyResolver environment)
DefaultPropertyPlaceholderResolver(PropertyResolver, ConversionService)
insteadenvironment
- The property resolver for the environmentpublic DefaultPropertyPlaceholderResolver(PropertyResolver environment, ConversionService conversionService)
environment
- The property resolver for the environmentconversionService
- The conversion servicepublic String getPrefix()
getPrefix
in interface PropertyPlaceholderResolver
public Optional<String> resolvePlaceholders(String str)
PropertyPlaceholderResolver
resolvePlaceholders
in interface PropertyPlaceholderResolver
str
- The placeholder to resolveOptional.empty()
if resolution was not possiblepublic String resolveRequiredPlaceholders(String str) throws ConfigurationException
PropertyPlaceholderResolver
resolveRequiredPlaceholders
in interface PropertyPlaceholderResolver
str
- The placeholder to resolveOptional.empty()
if resolution was not possibleConfigurationException
- If the placeholders could not be resolvedpublic <T> T resolveRequiredPlaceholder(String str, Class<T> type) throws ConfigurationException
PropertyPlaceholderResolver
resolveRequiredPlaceholder
in interface PropertyPlaceholderResolver
T
- The type the value should be converted tostr
- The string containing the placeholdertype
- The class of the typeConfigurationException
- If multiple placeholders are found or
if the placeholder could not be converted to the requested typepublic List<DefaultPropertyPlaceholderResolver.Segment> buildSegments(String str)
str
- The placeholder@Deprecated protected boolean resolveReplacement(StringBuilder builder, String str, String expr)
resolveExpression(String, String, Class)
builder
- The builderstr
- The full stringexpr
- The current expression@Nullable protected <T> T resolveExpression(String context, String expression, Class<T> type)
T
- The type the expression should be converted tocontext
- The context of the expressionexpression
- The expressiontype
- The class