/** * Sets the serialization of CSV-encoded Select results. * * @param csvOutput The new csv value. * @return This object for method chaining. */ public OutputSerialization withCsv(CSVOutput csvOutput) { setCsv(csvOutput); return this; }
/** * Specifies JSON as request's output serialization format. */ public OutputSerialization withJson(JSONOutput json) { setJson(json); return this; }
private static SelectObjectContentRequest generateBaseCSVRequest(String bucket, String key, String query) { SelectObjectContentRequest request = new SelectObjectContentRequest(); request.setBucketName(bucket); request.setKey(key); request.setExpression(query); request.setExpressionType(ExpressionType.SQL); InputSerialization inputSerialization = new InputSerialization(); inputSerialization.setCsv(new CSVInput()); inputSerialization.setCompressionType(CompressionType.NONE); request.setInputSerialization(inputSerialization); OutputSerialization outputSerialization = new OutputSerialization(); outputSerialization.setCsv(new CSVOutput()); request.setOutputSerialization(outputSerialization); return request; } }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getInputSerialization() == null) ? 0 : getInputSerialization().hashCode()); hashCode = prime * hashCode + ((getExpressionType() == null) ? 0 : getExpressionType().hashCode()); hashCode = prime * hashCode + ((getExpression() == null) ? 0 : getExpression().hashCode()); hashCode = prime * hashCode + ((getOutputSerialization() == null) ? 0 : getOutputSerialization().hashCode()); return hashCode; }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || ! (obj instanceof SelectParameters)) { return false; } final SelectParameters other = (SelectParameters) obj; if (other.getInputSerialization() == null ^ this.getInputSerialization() == null) return false; if (other.getInputSerialization() != null && !other.getInputSerialization().equals(this.getInputSerialization())) return false; if (other.getExpressionType() == null ^ this.getExpressionType() == null) return false; if (other.getExpressionType() != null && !other.getExpressionType().equals(this.getExpressionType())) return false; if (other.getExpression() == null ^ this.getExpression() == null) return false; if (other.getExpression() != null && !other.getExpression().equals(this.getExpression())) return false; if (other.getOutputSerialization() == null ^ this.getOutputSerialization() == null) return false; if (other.getOutputSerialization() != null && !other.getOutputSerialization().equals(this.getOutputSerialization())) return false; return true; }
selectObjectRequest.setInputSerialization(selectObjectInputSerialization); OutputSerialization selectObjectOutputSerialization = new OutputSerialization(); CSVOutput selectObjectCSVOutputSerialization = new CSVOutput(); selectObjectCSVOutputSerialization.setRecordDelimiter(lineDelimiter); selectObjectCSVOutputSerialization.setQuoteCharacter(quoteChar); selectObjectCSVOutputSerialization.setQuoteEscapeCharacter(escapeChar); selectObjectOutputSerialization.setCsv(selectObjectCSVOutputSerialization); selectObjectRequest.setOutputSerialization(selectObjectOutputSerialization);
selectObjectRequest.setInputSerialization(selectObjectInputSerialization); OutputSerialization selectObjectOutputSerialization = new OutputSerialization(); CSVOutput selectObjectCSVOutputSerialization = new CSVOutput(); selectObjectCSVOutputSerialization.setRecordDelimiter(lineDelimiter); selectObjectCSVOutputSerialization.setQuoteCharacter(quoteChar); selectObjectCSVOutputSerialization.setQuoteEscapeCharacter(escapeChar); selectObjectOutputSerialization.setCsv(selectObjectCSVOutputSerialization); selectObjectRequest.setOutputSerialization(selectObjectOutputSerialization);
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || ! (obj instanceof OutputSerialization)) { return false; } final OutputSerialization other = (OutputSerialization) obj; if (other.getCsv() == null ^ this.getCsv() == null) return false; if (other.getCsv() != null && !other.getCsv().equals(this.getCsv())) return false; if (other.getJson() == null ^ this.getJson() == null) return false; if (other.getJson() != null && !other.getJson().equals(this.getJson())) return false; return true; }
private static void addOutputSerializationIfNotNull(XmlWriter xml, OutputSerialization outputSerialization) { if (outputSerialization != null) { xml.start("OutputSerialization"); if (outputSerialization.getCsv() != null) { xml.start("CSV"); CSVOutput csvOutput = outputSerialization.getCsv(); addIfNotNull(xml, "QuoteFields", csvOutput.getQuoteFields()); addIfNotNull(xml, "QuoteEscapeCharacter", csvOutput.getQuoteEscapeCharacterAsString()); addIfNotNull(xml, "RecordDelimiter", csvOutput.getRecordDelimiterAsString()); addIfNotNull(xml, "FieldDelimiter", csvOutput.getFieldDelimiterAsString()); addIfNotNull(xml, "QuoteCharacter", csvOutput.getQuoteCharacterAsString()); xml.end(); } if (outputSerialization.getJson() != null) { xml.start("JSON"); JSONOutput jsonOutput = outputSerialization.getJson(); addIfNotNull(xml, "RecordDelimiter", jsonOutput.getRecordDelimiterAsString()); xml.end(); } xml.end(); } }