Code example for CharMatcher

Methods: indexIn

0
        if (value.startsWith(SEPARATOR) || value.endsWith(SEPARATOR)) { 
            throw new InvalidPluginIdException(value, ID_SEPARATOR_ON_START_OR_END); 
        } else if (value.contains(PluginId.SEPARATOR + PluginId.SEPARATOR)) { 
            throw new InvalidPluginIdException(value, DOUBLE_SEPARATOR); 
        } else { 
            int invalidCharIndex = PluginId.INVALID_PLUGIN_ID_CHAR_MATCHER.indexIn(value); 
            if (invalidCharIndex >= 0) { 
                char invalidChar = value.charAt(invalidCharIndex); 
                throw new InvalidPluginIdException(value, invalidPluginIdCharMessage(invalidChar)); 
            } 
        } 
    } 
 
    public static String invalidPluginIdCharMessage(char invalidChar) { 
        return "Plugin id contains invalid char '" + invalidChar + "' (only " + PluginId.PLUGIN_ID_VALID_CHARS_DESCRIPTION + " characters are valid)"; 
    } 
 
    public boolean isQualified() { 
        return value.contains(PluginId.SEPARATOR); 
    }