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

com.enonic.xp.util.CharacterChecker Maven / Gradle / Ivy

The newest version!
package com.enonic.xp.util;

import com.google.common.base.CharMatcher;

public final class CharacterChecker
{
    private static final CharMatcher ILLEGAL_CHAR_MATCHER = CharMatcher.anyOf( "<>\"'" );

    public static String check( final String value, final String errorMessage )
    {
        if ( ILLEGAL_CHAR_MATCHER.matchesAnyOf( value ) )
        {
            throw new IllegalArgumentException( errorMessage );
        }

        return value;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy