Example usage for twitter4j FilterQuery locations

List of usage examples for twitter4j FilterQuery locations

Introduction

In this page you can find the example usage for twitter4j FilterQuery locations.

Prototype

null locations

To view the source code for twitter4j FilterQuery locations.

Click Source Link

Usage

From source file:uk.ac.susx.tag.method51.twitter.params.FilterQueryParams.java

License:Apache License

public FilterQuery buildFilterQuery() {

    if (getKeywords().size() == 0 && getFollowIds().size() == 0 && getLocations().size() == 0)
        throw new RuntimeException("No keywords or user ids provided");

    final FilterQuery query = new FilterQuery();

    if (!getLanguages().isEmpty()) {
        LOG.info("Languages: {}", getLanguages());
        query.language(getLanguages().toArray(new String[getLanguages().size()]));
    }//from   w w w .  j a  va  2s. c om

    if (!getKeywords().isEmpty()) {
        LOG.info("Tracking keywords: {}", getKeywords());
        query.track(getKeywords().toArray(new String[getKeywords().size()]));
    }

    if (!getFollowIds().isEmpty()) {
        LOG.info("Tracking ids: {}", getFollowIds());
        query.follow(ArrayUtil.unbox(getFollowIds().toArray(new Long[getFollowIds().size()])));
    }

    if (!getLocations().isEmpty()) {
        LOG.info("Locations co-ords: {}", getLocations());
        query.locations(toArray(getLocations()));
    }

    return query;

}