/** * Optionally specify a data transformation function for the request. * * @param transform the data transformation method that the server should pre-process the data with * @return a Builder instance, not null */ public Builder withTransform(final Transform transform) { ArgumentChecker.notNull(transform, "transform"); _transform = transform; return this; }
/** * Optionally specify a start date cut-off for the request. * * @param startDate the start date of the request (inclusive), not null * @return a Builder instance, not null */ public Builder withStartDate(final LocalDate startDate) { ArgumentChecker.notNull(startDate, "startDate"); _startDate = startDate; return this; }
/** * Optionally specify the sort order of the results. * * @param sortOrder the sort order of the results * @return a Builder object onto which you can chain additional calls */ public Builder withSortOrder(final SortOrder sortOrder) { ArgumentChecker.notNull(sortOrder, "sortOrder"); _sortOrder = sortOrder; return this; }
/** * Optionally specify a data transformation function for the request. * * @param transform the data transformation method that the server should pre-process the data with * @return a Builder instance, not null */ public Builder withTransform(final Transform transform) { ArgumentChecker.notNull(transform, "transform"); _transform = transform; return this; }
/** * Optionally specify the sort order of the results. * * @param sortOrder the sort order of the results * @return a Builder object onto which you can chain additional calls */ public Builder withSortOrder(final SortOrder sortOrder) { ArgumentChecker.notNull(sortOrder, "sortOrder"); _sortOrder = sortOrder; return this; }
/** * Specify a custom RESTDataProvider for the session to use when sending requests, intended for testing purposes. * * @deprecated you should pass this into the QuandlSessionFactory instead * @param restDataProvider a RESTDataProvider for the session * @return this builder */ public Builder withRESTDataProvider(final RESTDataProvider restDataProvider) { ArgumentChecker.notNull(restDataProvider, "restDataProvider"); _restDataProvider = restDataProvider; _isRestDataProviderSet = true; return this; }
/** * Specify the database to search within. For example WIKI * * @param databaseCode the database code to search within, not null. * @return this Builder, with this database code specified */ public Builder withDatabaseCode(final String databaseCode) { ArgumentChecker.notNull(databaseCode, "databaseCode"); _databaseCode = databaseCode; return this; }
/** * Specify the search term to use for your query. Multiple search terms can be separated by * the + character. * * @param query the query string to use, not null * @return this Builder, with this query added */ public Builder withQuery(final String query) { ArgumentChecker.notNull(query, "query"); _query = query; return this; }
/** * Optionally specify an end date cut-off for the request. * * @param endDate the end date of the request (inclusive), not null * @return a Builder instance, not null */ public Builder withEndDate(final LocalDate endDate) { ArgumentChecker.notNull(endDate, "endDate"); _endDate = endDate; return this; }
/** * Optionally specify an end date cut-off for the request. * * @param endDate the end date of the request (inclusive), not null * @return a Builder instance, not null */ public Builder withEndDate(final LocalDate endDate) { ArgumentChecker.notNull(endDate, "endDate"); _endDate = endDate; return this; }
/** * Optionally specify the sampling frequency for the request. * * @param frequency the sampling frequency, not null * @return a Builder instance, not null */ public Builder withFrequency(final Frequency frequency) { ArgumentChecker.notNull(frequency, "frequency"); _frequency = frequency; return this; }
/** * Factory method for creating and instance of a MetaDataResult. * * @param jsonObject the JSON object returned by Quandl, not null * @return a MetaDataResult instance, not null */ public static SearchResult of(final JSONObject jsonObject) { ArgumentChecker.notNull(jsonObject, "jsonObject"); return new SearchResult(jsonObject); }
/** * Request just a single column for a given quandlCode. * * @param quandlCode the Quandl code you're interested in, not null * @param columnNumber the column number (determined by meta-data or a single request) of the data you want, not null * @return an request instance, not null */ public static QuandlCodeRequest singleColumn(final String quandlCode, final int columnNumber) { ArgumentChecker.notNull(quandlCode, "quandlCode"); return new QuandlCodeRequest(quandlCode, columnNumber); }
/** * Specify a specific auth token. * * @param authToken your auth token * @return a Builder object for chaining, call build() to complete */ public static Builder withAuthToken(final String authToken) { ArgumentChecker.notNull(authToken, "authToken"); return new Builder(authToken); }
/** * Create a ResultSaver using a custom base directory with it's filename counter set to zero. * @param baseDir the directory in which to save files */ public ResultSaver(final File baseDir) { ArgumentChecker.notNull(baseDir, "baseDir"); _baseDir = baseDir; }
/** * Create a Quandl session to use a specific authorization token (authToken) with all requests. Using a token means you can make more * requests. Note that this method does not check the quandl.auth.token property. Creating this object does not make any actual API * requests, the token is used in subsequent requests. * * @param authToken a Quandl API authorization token * @return an instance of the Quandl session with an embedded authorization token */ public static QuandlSession create(final String authToken) { ArgumentChecker.notNull(authToken, "authToken"); return new QuandlSession(SessionOptions.Builder.withAuthToken(authToken).build()); }
/** * Save a TabularResult into a file in pretty printed format. * @param tabularResult the tabular result to save */ public final void processResult(final TabularResult tabularResult) { ArgumentChecker.notNull(tabularResult, "tabularResult"); File file = new File(_baseDir, TABULAR + _fileNumber.getAndIncrement() + TXT); writeFile(file, PrettyPrinter.toPrettyPrintedString(tabularResult)); } /**
/** * Save a map of String to HeaderDefinition. * @param multiHeaderDefinitionResult a map of String to HeaderDefinition, not null */ public final void processResult(final Map<String, HeaderDefinition> multiHeaderDefinitionResult) { ArgumentChecker.notNull(multiHeaderDefinitionResult, "multiHeaderDefinitionResult"); File file = new File(_baseDir, METADATA + _fileNumber.getAndIncrement() + TXT); writeFile(file, PrettyPrinter.toPrettyPrintedString(multiHeaderDefinitionResult)); }
/** * Save a map of String to HeaderDefinition. * @param multiHeaderDefinitionResult a map of String to HeaderDefinition, not null */ public final void processResult(final Map<String, HeaderDefinition> multiHeaderDefinitionResult) { ArgumentChecker.notNull(multiHeaderDefinitionResult, "multiHeaderDefinitionResult"); File file = new File(_baseDir, METADATA + _fileNumber.getAndIncrement() + TXT); writeFile(file, PrettyPrinter.toPrettyPrintedString(multiHeaderDefinitionResult)); }
/** * Save a MetaDataResult into a file in pretty printed format. * @param metaDataResult the metaDataResult object to save */ public final void processResult(final MetaDataResult metaDataResult) { ArgumentChecker.notNull(metaDataResult, "metaDataResult"); processResult(metaDataResult.getRawJSON()); }