Example usage for org.apache.commons.lang3 ExtendedStringUtils SAFE_TOSTRING_XFORMER

List of usage examples for org.apache.commons.lang3 ExtendedStringUtils SAFE_TOSTRING_XFORMER

Introduction

In this page you can find the example usage for org.apache.commons.lang3 ExtendedStringUtils SAFE_TOSTRING_XFORMER.

Prototype

ExtendedTransformer SAFE_TOSTRING_XFORMER

To view the source code for org.apache.commons.lang3 ExtendedStringUtils SAFE_TOSTRING_XFORMER.

Click Source Link

Document

An ExtendedTransformer implementation that transforms any Object into a String using the #safeToString(Object) method

Usage

From source file:org.springframework.util.ExtendedPlaceholderResolverUtils.java

public static final NamedExtendedPlaceholderResolver toPlaceholderResolver(final Properties props) {
    if (ExtendedMapUtils.isEmpty(props)) {
        return EMPTY_RESOLVER;
    } else {/*from   w ww. j a v a  2 s  . c o  m*/

        return new NamedExtendedPlaceholderResolver() {
            @Override
            public Collection<String> getPlaceholderNames() {
                return ExtendedCollectionUtils.collectToList(props.keySet(),
                        ExtendedStringUtils.SAFE_TOSTRING_XFORMER);
            }

            @Override
            public String resolvePlaceholder(String placeholderName) {
                return props.getProperty(placeholderName);
            }

            @Override
            public String resolvePlaceholder(String placeholderName, String defaultValue) {
                return props.getProperty(placeholderName, defaultValue);
            }
        };
    }
}