Java Code Examples for org.springframework.util.PropertyPlaceholderHelper#PlaceholderResolver

The following examples show how to use org.springframework.util.PropertyPlaceholderHelper#PlaceholderResolver . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MessageTemplateServiceImpl.java    From JuniperBot with GNU General Public License v3.0 6 votes vote down vote up
private MessageTemplatePlaceholderResolver getPropertyResolver(@NonNull MessageTemplateCompiler compiler) {
    Set<PropertyPlaceholderHelper.PlaceholderResolver> resolvers = new HashSet<>();
    resolvers.add(compiler.getVariables());
    resolvers.addAll(compiler.getResolverSet());
    Locale locale = null;
    if (compiler.getGuild() != null) {
        locale = contextService.getLocale(compiler.getGuild());
        resolvers.add(GuildPlaceholderResolver.of(compiler.getGuild(), locale, applicationContext, "server"));
    }
    if (compiler.getMember() != null) {
        if (locale == null) {
            locale = contextService.getLocale(compiler.getMember().getGuild());
        }
        resolvers.add(MemberPlaceholderResolver.of(compiler.getMember(), locale, applicationContext, "member"));
    }
    TextChannel channel = getTargetChannel(compiler);
    if (channel != null) {
        if (locale == null) {
            locale = contextService.getLocale(channel.getGuild());
        }
        resolvers.add(ChannelPlaceholderResolver.of(channel, locale, applicationContext, "channel"));
    }
    return new MessageTemplatePlaceholderResolver(resolvers);
}
 
Example 2
Source File: MessageTemplateCompiler.java    From JuniperBot with GNU General Public License v3.0 4 votes vote down vote up
public MessageTemplateCompiler withResolver(PropertyPlaceholderHelper.PlaceholderResolver resolver) {
    this.resolverSet.add(resolver);
    return this;
}
 
Example 3
Source File: MessageTemplatePlaceholderResolver.java    From JuniperBot with GNU General Public License v3.0 4 votes vote down vote up
public MessageTemplatePlaceholderResolver(PropertyPlaceholderHelper.PlaceholderResolver... resolvers) {
    this(resolvers != null ? Arrays.asList(resolvers) : Collections.emptySet());
}
 
Example 4
Source File: MessageTemplatePlaceholderResolver.java    From JuniperBot with GNU General Public License v3.0 4 votes vote down vote up
public MessageTemplatePlaceholderResolver(Collection<? extends PropertyPlaceholderHelper.PlaceholderResolver> resolvers) {
    this.resolvers = Set.copyOf(resolvers);
}
 
Example 5
Source File: ContractDslSnippet.java    From spring-cloud-contract with Apache License 2.0 4 votes vote down vote up
private String replacePlaceholders(
		PropertyPlaceholderHelper.PlaceholderResolver resolver, String input) {
	return this.propertyPlaceholderHelper.replacePlaceholders(input, resolver);
}