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

com.avides.xpath.utils.converters.ToCharacterConverter Maven / Gradle / Ivy

The newest version!
package com.avides.xpath.utils.converters;

import java.util.function.Function;

/**
 * A converter ({@link java.util.function.Function Function}) that converts to a
 * {@link java.lang.Character Character}. If the found value is longer than 1
 * character, the first character will be returned. If the value is
 * null or the found value is empty, null will be
 * returned.
 *
 * @author Martin Schumacher
 * @since 1.0.0.RELEASE
 */
public class ToCharacterConverter implements Function
{
    @Override
    public Character apply(String t)
    {
        return (t != null) && (t.length() > 0) ? Character.valueOf(t.charAt(0)) : null;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy