public static String getValueAsString()

in src/main/java/org/apache/commons/validator/util/ValidatorUtils.java [115:139]


    public static String getValueAsString(final Object bean, final String property) {
        Object value = null;

        try {
            value = PropertyUtils.getProperty(bean, property);

        } catch (final ReflectiveOperationException e) {
            LOG.error(e.getMessage(), e);
        }

        if (value == null) {
            return null;
        }

        if (value instanceof String[]) {
            return ((String[]) value).length > 0 ? value.toString() : "";

        }
        if (value instanceof Collection) {
            return ((Collection<?>) value).isEmpty() ? "" : value.toString();

        }
        return value.toString();

    }