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

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

Introduction

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

Prototype

public static final String safeToString(Object obj) 

Source Link

Usage

From source file:org.springframework.core.convert.support.ExtendedObjectToStringConverter.java

@Override
public String convert(Object source) {
    return ExtendedStringUtils.safeToString(source);
}

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

public static final ExtendedPlaceholderResolver toPlaceholderResolver(final PropertySources sources) {
    if (sources == null) {
        return EMPTY_RESOLVER;
    } else {//w  ww  .j  a  v a  2 s .  co  m
        return new AbstractExtendedPlaceholderResolver() {
            @Override
            public String resolvePlaceholder(String placeholderName) {
                for (PropertySource<?> src : sources) {
                    Object value = src.getProperty(placeholderName);
                    String s = ExtendedStringUtils.safeToString(value);
                    if (s == null) {
                        continue; // debug breakpoint
                    } else {
                        return s;
                    }
                }

                return null;
            }
        };
    }
}