All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.duracloud.syncui.config.StringTrimmerConverter Maven / Gradle / Ivy

There is a newer version: 8.1.0
Show newest version
/*
 * The contents of this file are subject to the license and copyright
 * detailed in the LICENSE and NOTICE files at the root of the source
 * tree and available online at
 *
 *     http://duracloud.org/license/
 */
package org.duracloud.syncui.config;

import org.springframework.core.convert.converter.Converter;

public class StringTrimmerConverter implements Converter {

    @Override
    public String convert(String source) {
        if (source == null) {
            return null;
        }

        String trimmed = ((String) source).trim();
        if (trimmed.length() == 0) {
            return null;
        } else {
            return trimmed;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy