/** * Print a nicely formatted representation of this object. Currently prints a nicely formatted ACSII table. * * @return a string containing a multi-line description of this object */ public String toPrettyPrintedString() { return PrettyPrinter.toPrettyPrintedString(this); } }
/** * Print a nicely formatted representation of this object. Currently prints a nicely formatted JSON representation. * * @return a string containing a multi-line description of this object */ public String toPrettyPrintedString() { return PrettyPrinter.toPrettyPrintedString(this); }
/** * Print a nicely formatted representation of this object. Currently prints a nicely formatted JSON representation. * * @return a string containing a multi-line description of this object */ public String toPrettyPrintedString() { return PrettyPrinter.toPrettyPrintedString(this); }
/** * Pretty print a MetaDataResult as an indented piece of JSON code. Throws a QuandlRuntimeException if it can't render the nested * JSONObject to a String. * * @param metaDataResult the metaDataResult, not null * @return a String representation of the object, probably multi-line. */ public static String toPrettyPrintedString(final MetaDataResult metaDataResult) { return toPrettyPrintedString(metaDataResult.getRawJSON()); }
/** * Pretty print a SearchResult as an indented piece of JSON code. Throws a QuandlRuntimeException if it can't render the nested JSONObject * to a String. * * @param searchResult the searchResult, not null * @return a String representation of the object, probably multi-line. */ public static String toPrettyPrintedString(final SearchResult searchResult) { return toPrettyPrintedString(searchResult.getRawJSON()); }
/** * Load file using internal counter to generate file name and compare contents to the result provided. * @param tabularResult the result to check file contents against */ public final void processResult(final TabularResult tabularResult) { File file = new File(_baseDir, TABULAR + _fileNumber.getAndIncrement() + TXT); if (file.exists()) { Assert.assertEquals(PrettyPrinter.toPrettyPrintedString(tabularResult), readFile(file)); } else { Assert.fail("File " + file + " does not exist"); } }
/** * Load file using internal counter to generate file name and compare contents to the result provided. * @param tabularResult the result to check file contents against */ public final void processResult(final TabularResult tabularResult) { File file = new File(_baseDir, TABULAR + _fileNumber.getAndIncrement() + TXT); if (file.exists()) { Assert.assertEquals(PrettyPrinter.toPrettyPrintedString(tabularResult), readFile(file)); } else { Assert.fail("File " + file + " does not exist"); } }
/** * Save a JSONObject into a file in pretty printed format. * @param jsonObject the JSON object to save */ private void processResult(final JSONObject jsonObject) { File file = new File(_baseDir, METADATA + _fileNumber.getAndIncrement() + JSON); // subtlety alert! The JSON object pretty printer adds a line separator at the end of the string to match the tabular result pretty printer. // This means when these are read back from a file, every line is terminated with a line separator. writeFile(file, PrettyPrinter.toPrettyPrintedString(jsonObject)); }
/** * Save a JSONObject into a file in pretty printed format. * @param jsonObject the JSON object to save */ private void processResult(final JSONObject jsonObject) { File file = new File(_baseDir, METADATA + _fileNumber.getAndIncrement() + JSON); // subtlety alert! The JSON object pretty printer adds a line separator at the end of the string to match the tabular result pretty printer. // This means when these are read back from a file, every line is terminated with a line separator. writeFile(file, PrettyPrinter.toPrettyPrintedString(jsonObject)); }
/** * 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 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)); }
private void processResult(final JSONObject jsonObject) { File file = new File(_baseDir, METADATA + _fileNumber.getAndIncrement() + JSON); if (file.exists()) { String value = PrettyPrinter.toPrettyPrintedString(jsonObject); String expected = readFile(file); outputDiff(value, expected); try { Assert.assertEquals(value, expected); } catch (AssertionError ae) { s_logger.error("Value exected was \n{}\n rather than \n{}\n as expected", value, expected); } } else { Assert.fail("File " + file + " does not exist"); } }
/** * 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)); } /**
private void processResult(final JSONObject jsonObject) { File file = new File(_baseDir, METADATA + _fileNumber.getAndIncrement() + JSON); if (file.exists()) { String value = PrettyPrinter.toPrettyPrintedString(jsonObject); String expected = readFile(file); outputDiff(value, expected); try { Assert.assertEquals(value, expected); } catch (AssertionError ae) { s_logger.error("Value exected was \n{}\n rather than \n{}\n as expected", value, expected); } } else { Assert.fail("File " + file + " does not exist"); } }
/** * Load file using internal counter to generate file name and compare contents to the result provided. * @param multiHeaderDefinitionResult a map of String to HeaderDefinition, not null */ public final void processResult(final Map<String, HeaderDefinition> multiHeaderDefinitionResult) { File file = new File(_baseDir, METADATA + _fileNumber.getAndIncrement() + TXT); if (file.exists()) { String value = PrettyPrinter.toPrettyPrintedString(multiHeaderDefinitionResult); String expected = readFile(file); outputDiff(value, expected); Assert.assertEquals(value, expected); } else { Assert.fail("File " + file + " does not exist"); } }
/** * Load file using internal counter to generate file name and compare contents to the result provided. * @param multiHeaderDefinitionResult a map of String to HeaderDefinition, not null */ public final void processResult(final Map<String, HeaderDefinition> multiHeaderDefinitionResult) { File file = new File(_baseDir, METADATA + _fileNumber.getAndIncrement() + TXT); if (file.exists()) { String value = PrettyPrinter.toPrettyPrintedString(multiHeaderDefinitionResult); String expected = readFile(file); outputDiff(value, expected); Assert.assertEquals(value, expected); } else { Assert.fail("File " + file + " does not exist"); } }
/** * The main body of the code. */ private void run() { QuandlSession session = QuandlSession.create(); Map<String, HeaderDefinition> headers = session.getMultipleHeaderDefinition(MultiMetaDataRequest.of("WIKI/AAPL", "DOE/RWTC", "WIKI/MSFT")); System.out.println(PrettyPrinter.toPrettyPrintedString(headers)); }
/** * The main body of the code. */ private void run() { ClassicQuandlSession quandl = ClassicQuandlSession.create(); SearchResult searchResult = quandl.search(SearchRequest.Builder.ofQuery("Apple").withMaxPerPage(2).build()); System.out.println(searchResult.toPrettyPrintedString()); for (MetaDataResult metaData : searchResult.getMetaDataResultList()) { System.out.println(PrettyPrinter.toPrettyPrintedString(metaData.getRawJSON())); } TabularResult tabularResult = null; tabularResult = quandl.getDataSet(DataSetRequest.Builder.of("WIKI/AAPL").withFrequency(Frequency.QUARTERLY) .withColumn(CLOSE_COLUMN).withTransform(Transform.NORMALIZE).build()); System.out.println(PrettyPrinter.toPrettyPrintedString(tabularResult)); MetaDataResult metaData = quandl.getMetaData(MetaDataRequest.of("WIKI/AAPL")); System.out.println(PrettyPrinter.toPrettyPrintedString(metaData.getRawJSON())); }
/** * The main body of the code. */ private void run() { QuandlSession quandl = QuandlSession.create(); SearchResult searchResult = quandl.search(SearchRequest.Builder.ofQuery("Apple").withMaxPerPage(2).build()); System.out.println(searchResult.toPrettyPrintedString()); for (MetaDataResult metaData : searchResult.getMetaDataResultList()) { System.out.println(PrettyPrinter.toPrettyPrintedString(metaData.getRawJSON())); } TabularResult tabularResult = null; tabularResult = quandl.getDataSet(DataSetRequest.Builder.of("WIKI/AAPL").withFrequency(Frequency.QUARTERLY) .withColumn(CLOSE_COLUMN).withTransform(Transform.NORMALIZE).build()); System.out.println(PrettyPrinter.toPrettyPrintedString(tabularResult)); TabularResult tabularResultMulti = quandl.getDataSets( MultiDataSetRequest.Builder.of( QuandlCodeRequest.allColumns("WIKI/AAPL"), QuandlCodeRequest.allColumns("DOE/RWTC") ).withStartDate(RECENTISH_DATE) .build()); System.out.println(PrettyPrinter.toPrettyPrintedString(tabularResultMulti)); MetaDataResult metaData = quandl.getMetaData(MetaDataRequest.of("WIKI/AAPL")); System.out.println(PrettyPrinter.toPrettyPrintedString(metaData.getRawJSON())); MetaDataResult metaData2 = quandl.getMetaData(MultiMetaDataRequest.of("WIKI/AAPL", "DOE/RWTC", "WIKI/MSFT")); System.out.println(PrettyPrinter.toPrettyPrintedString(metaData2.getRawJSON())); }