class TextPatternValidationUtils {

    public static boolean validateValueType( TextPattern textPattern, ValueType valueType )
    {
        if ( ValueType.TEXT.equals( valueType ) )
        {
            return true;
        }
        else if ( ValueType.NUMBER.equals( valueType ) )
        {
            boolean isAllNumbers = true;

            for ( TextPatternSegment segment : textPattern.getSegments() )
            {
                isAllNumbers = isAllNumbers && isNumericOnly( segment );
            }

            return isAllNumbers;
        }
        else
        {
            return false;
        }
    }

}