ConfigurablePropertyResolver

此接口是大多数PropertyResolver实现类的父接口,它规范了使用property的方法,并且使用户可以定制化PropertyResolver在解析和转换property时候的逻辑

public interface ConfigurablePropertyResolver extends PropertyResolver {

    /**
     * 返回在解析属性时使用的ConfigurableConversionService。此方法的返回值可被用户定制化,
     * 例如可以移除或者添加Converter
     * ConfigurableConversionService cs = env.getConversionService();
     * cs.addConverter(new FooConverter());
     */
    ConfigurableConversionService getConversionService();

    /**
     * 设置在涉及到属性转换操作时所使用到的ConfigurableConversionService。
     * 全部替换ConfigurableConversionService的操作不常用,更常用的一种方法是使用getConversionService
     * 
     * <p><strong>Note:</strong> as an alternative to fully replacing the
     * {@code ConversionService}, consider adding or removing individual
     * {@code Converter} instances by drilling into {@link #getConversionService()}
     * and calling methods such as {@code #addConverter}.
     * @see PropertyResolver#getProperty(String, Class)
     * @see #getConversionService()
     * @see org.springframework.core.convert.converter.ConverterRegistry#addConverter
     */
    void setConversionService(ConfigurableConversionService conversionService);

    /**
     * Set the prefix that placeholders replaced by this resolver must begin with.
     */
    void setPlaceholderPrefix(String placeholderPrefix);

    /**
     * Set the suffix that placeholders replaced by this resolver must end with.
     */
    void setPlaceholderSuffix(String placeholderSuffix);

    /**
     * Specify the separating character between the placeholders replaced by this
     * resolver and their associated default value, or {@code null} if no such
     * special character should be processed as a value separator.
     */
    void setValueSeparator(String valueSeparator);

    /**
     * Set whether to throw an exception when encountering an unresolvable placeholder
     * nested within the value of a given property. A {@code false} value indicates strict
     * resolution, i.e. that an exception will be thrown. A {@code true} value indicates
     * that unresolvable nested placeholders should be passed through in their unresolved
     * ${...} form.
     * <p>Implementations of {@link #getProperty(String)} and its variants must inspect
     * the value set here to determine correct behavior when property values contain
     * unresolvable placeholders.
     * @since 3.2
     */
    void setIgnoreUnresolvableNestedPlaceholders(boolean ignoreUnresolvableNestedPlaceholders);

    /**
     * Specify which properties must be present, to be verified by
     * {@link #validateRequiredProperties()}.
     */
    void setRequiredProperties(String... requiredProperties);

    /**
     * Validate that each of the properties specified by
     * {@link #setRequiredProperties} is present and resolves to a
     * non-{@code null} value.
     * @throws MissingRequiredPropertiesException if any of the required
     * properties are not resolvable.
     */
    void validateRequiredProperties() throws MissingRequiredPropertiesException;

}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值