Code example for Splitter

Methods: split

0
    private int serialEnd;
    private QueryArgument queryArgument;
 
    public Query(final String supportedSource, final String queryString) {
        this.supportedSource = supportedSource;
        options = PARSER.parse(Iterables.toArray(SPACE_SPLITTER.split(queryString), String.class));
 
        validateAndParseQuery(); 
    } 
 
    private void validateAndParseQuery() { 
        if (!options.hasOptions()) {
            throw new IllegalArgumentException("%ERROR:405: no flags passed");
        } 
 
        if (options.has("q") && (options.has("g") || options.has("k"))) {
            throw new IllegalArgumentException("%ERROR:405: -q cannot be used with any other options");
        } 
 
        if (options.has("k") && !options.has("g")) {
            throw new IllegalArgumentException("%ERROR:405: -k cannot be used with out -g");