@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getCsv() != null) sb.append("Csv: ").append(getCsv()); if (getJson() != null) sb.append("Json: ").append(getJson()); if (getCompressionType() != null) sb.append("CompressionType: ").append(getCompressionType()); sb.append("}"); return sb.toString(); }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getCsv() == null) ? 0 : getCsv().hashCode()); hashCode = prime * hashCode + ((getJson() == null) ? 0 : getJson().hashCode()); hashCode = prime * hashCode + ((getCompressionType() == null) ? 0 : getCompressionType().hashCode()); return hashCode; }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || ! (obj instanceof InputSerialization)) { return false; } final InputSerialization other = (InputSerialization) 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; if (other.getCompressionType() == null ^ this.getCompressionType() == null) return false; if (other.getCompressionType() != null && !other.getCompressionType().equals(this.getCompressionType())) return false; return true; }
private static void addInputSerializationIfNotNull(XmlWriter xml, InputSerialization inputSerialization) { if (inputSerialization != null) { xml.start("InputSerialization"); if (inputSerialization.getCsv() != null) { xml.start("CSV"); CSVInput csvInput = inputSerialization.getCsv(); addIfNotNull(xml, "FileHeaderInfo", csvInput.getFileHeaderInfo()); addIfNotNull(xml, "Comments", csvInput.getCommentsAsString()); addIfNotNull(xml, "QuoteEscapeCharacter", csvInput.getQuoteEscapeCharacterAsString()); addIfNotNull(xml, "RecordDelimiter", csvInput.getRecordDelimiterAsString()); addIfNotNull(xml, "FieldDelimiter", csvInput.getFieldDelimiterAsString()); addIfNotNull(xml, "QuoteCharacter", csvInput.getQuoteCharacterAsString()); addIfNotNull(xml, "AllowQuotedRecordDelimiter", csvInput.getAllowQuotedRecordDelimiter()); xml.end(); } if (inputSerialization.getJson() != null) { xml.start("JSON"); JSONInput jsonInput = inputSerialization.getJson(); addIfNotNull(xml, "Type", jsonInput.getType()); xml.end(); } if (inputSerialization.getParquet() != null) { xml.start("Parquet"); xml.end(); } addIfNotNull(xml, "CompressionType", inputSerialization.getCompressionType()); xml.end(); } }