com.amazonaws.services.kinesisfirehose.model.OpenXJsonSerDe Maven / Gradle / Ivy
Show all versions of aws-java-sdk-kinesis Show documentation
/*
* Copyright 2019-2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.kinesisfirehose.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* The OpenX SerDe. Used by Firehose for deserializing data, which means converting it from the JSON format in
* preparation for serializing it to the Parquet or ORC format. This is one of two deserializers you can choose,
* depending on which one offers the functionality you need. The other option is the native Hive / HCatalog JsonSerDe.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class OpenXJsonSerDe implements Serializable, Cloneable, StructuredPojo {
/**
*
* When set to true
, specifies that the names of the keys include dots and that you want Firehose to
* replace them with underscores. This is useful because Apache Hive does not allow dots in column names. For
* example, if the JSON contains a key whose name is "a.b", you can define the column name to be "a_b" when using
* this option.
*
*
* The default is false
.
*
*/
private Boolean convertDotsInJsonKeysToUnderscores;
/**
*
* When set to true
, which is the default, Firehose converts JSON keys to lowercase before
* deserializing them.
*
*/
private Boolean caseInsensitive;
/**
*
* Maps column names to JSON keys that aren't identical to the column names. This is useful when the JSON contains
* keys that are Hive keywords. For example, timestamp
is a Hive keyword. If you have a JSON key named
* timestamp
, set this parameter to {"ts": "timestamp"}
to map this key to a column named
* ts
.
*
*/
private java.util.Map columnToJsonKeyMappings;
/**
*
* When set to true
, specifies that the names of the keys include dots and that you want Firehose to
* replace them with underscores. This is useful because Apache Hive does not allow dots in column names. For
* example, if the JSON contains a key whose name is "a.b", you can define the column name to be "a_b" when using
* this option.
*
*
* The default is false
.
*
*
* @param convertDotsInJsonKeysToUnderscores
* When set to true
, specifies that the names of the keys include dots and that you want
* Firehose to replace them with underscores. This is useful because Apache Hive does not allow dots in
* column names. For example, if the JSON contains a key whose name is "a.b", you can define the column name
* to be "a_b" when using this option.
*
* The default is false
.
*/
public void setConvertDotsInJsonKeysToUnderscores(Boolean convertDotsInJsonKeysToUnderscores) {
this.convertDotsInJsonKeysToUnderscores = convertDotsInJsonKeysToUnderscores;
}
/**
*
* When set to true
, specifies that the names of the keys include dots and that you want Firehose to
* replace them with underscores. This is useful because Apache Hive does not allow dots in column names. For
* example, if the JSON contains a key whose name is "a.b", you can define the column name to be "a_b" when using
* this option.
*
*
* The default is false
.
*
*
* @return When set to true
, specifies that the names of the keys include dots and that you want
* Firehose to replace them with underscores. This is useful because Apache Hive does not allow dots in
* column names. For example, if the JSON contains a key whose name is "a.b", you can define the column name
* to be "a_b" when using this option.
*
* The default is false
.
*/
public Boolean getConvertDotsInJsonKeysToUnderscores() {
return this.convertDotsInJsonKeysToUnderscores;
}
/**
*
* When set to true
, specifies that the names of the keys include dots and that you want Firehose to
* replace them with underscores. This is useful because Apache Hive does not allow dots in column names. For
* example, if the JSON contains a key whose name is "a.b", you can define the column name to be "a_b" when using
* this option.
*
*
* The default is false
.
*
*
* @param convertDotsInJsonKeysToUnderscores
* When set to true
, specifies that the names of the keys include dots and that you want
* Firehose to replace them with underscores. This is useful because Apache Hive does not allow dots in
* column names. For example, if the JSON contains a key whose name is "a.b", you can define the column name
* to be "a_b" when using this option.
*
* The default is false
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public OpenXJsonSerDe withConvertDotsInJsonKeysToUnderscores(Boolean convertDotsInJsonKeysToUnderscores) {
setConvertDotsInJsonKeysToUnderscores(convertDotsInJsonKeysToUnderscores);
return this;
}
/**
*
* When set to true
, specifies that the names of the keys include dots and that you want Firehose to
* replace them with underscores. This is useful because Apache Hive does not allow dots in column names. For
* example, if the JSON contains a key whose name is "a.b", you can define the column name to be "a_b" when using
* this option.
*
*
* The default is false
.
*
*
* @return When set to true
, specifies that the names of the keys include dots and that you want
* Firehose to replace them with underscores. This is useful because Apache Hive does not allow dots in
* column names. For example, if the JSON contains a key whose name is "a.b", you can define the column name
* to be "a_b" when using this option.
*
* The default is false
.
*/
public Boolean isConvertDotsInJsonKeysToUnderscores() {
return this.convertDotsInJsonKeysToUnderscores;
}
/**
*
* When set to true
, which is the default, Firehose converts JSON keys to lowercase before
* deserializing them.
*
*
* @param caseInsensitive
* When set to true
, which is the default, Firehose converts JSON keys to lowercase before
* deserializing them.
*/
public void setCaseInsensitive(Boolean caseInsensitive) {
this.caseInsensitive = caseInsensitive;
}
/**
*
* When set to true
, which is the default, Firehose converts JSON keys to lowercase before
* deserializing them.
*
*
* @return When set to true
, which is the default, Firehose converts JSON keys to lowercase before
* deserializing them.
*/
public Boolean getCaseInsensitive() {
return this.caseInsensitive;
}
/**
*
* When set to true
, which is the default, Firehose converts JSON keys to lowercase before
* deserializing them.
*
*
* @param caseInsensitive
* When set to true
, which is the default, Firehose converts JSON keys to lowercase before
* deserializing them.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public OpenXJsonSerDe withCaseInsensitive(Boolean caseInsensitive) {
setCaseInsensitive(caseInsensitive);
return this;
}
/**
*
* When set to true
, which is the default, Firehose converts JSON keys to lowercase before
* deserializing them.
*
*
* @return When set to true
, which is the default, Firehose converts JSON keys to lowercase before
* deserializing them.
*/
public Boolean isCaseInsensitive() {
return this.caseInsensitive;
}
/**
*
* Maps column names to JSON keys that aren't identical to the column names. This is useful when the JSON contains
* keys that are Hive keywords. For example, timestamp
is a Hive keyword. If you have a JSON key named
* timestamp
, set this parameter to {"ts": "timestamp"}
to map this key to a column named
* ts
.
*
*
* @return Maps column names to JSON keys that aren't identical to the column names. This is useful when the JSON
* contains keys that are Hive keywords. For example, timestamp
is a Hive keyword. If you have
* a JSON key named timestamp
, set this parameter to {"ts": "timestamp"}
to map
* this key to a column named ts
.
*/
public java.util.Map getColumnToJsonKeyMappings() {
return columnToJsonKeyMappings;
}
/**
*
* Maps column names to JSON keys that aren't identical to the column names. This is useful when the JSON contains
* keys that are Hive keywords. For example, timestamp
is a Hive keyword. If you have a JSON key named
* timestamp
, set this parameter to {"ts": "timestamp"}
to map this key to a column named
* ts
.
*
*
* @param columnToJsonKeyMappings
* Maps column names to JSON keys that aren't identical to the column names. This is useful when the JSON
* contains keys that are Hive keywords. For example, timestamp
is a Hive keyword. If you have a
* JSON key named timestamp
, set this parameter to {"ts": "timestamp"}
to map this
* key to a column named ts
.
*/
public void setColumnToJsonKeyMappings(java.util.Map columnToJsonKeyMappings) {
this.columnToJsonKeyMappings = columnToJsonKeyMappings;
}
/**
*
* Maps column names to JSON keys that aren't identical to the column names. This is useful when the JSON contains
* keys that are Hive keywords. For example, timestamp
is a Hive keyword. If you have a JSON key named
* timestamp
, set this parameter to {"ts": "timestamp"}
to map this key to a column named
* ts
.
*
*
* @param columnToJsonKeyMappings
* Maps column names to JSON keys that aren't identical to the column names. This is useful when the JSON
* contains keys that are Hive keywords. For example, timestamp
is a Hive keyword. If you have a
* JSON key named timestamp
, set this parameter to {"ts": "timestamp"}
to map this
* key to a column named ts
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public OpenXJsonSerDe withColumnToJsonKeyMappings(java.util.Map columnToJsonKeyMappings) {
setColumnToJsonKeyMappings(columnToJsonKeyMappings);
return this;
}
/**
* Add a single ColumnToJsonKeyMappings entry
*
* @see OpenXJsonSerDe#withColumnToJsonKeyMappings
* @returns a reference to this object so that method calls can be chained together.
*/
public OpenXJsonSerDe addColumnToJsonKeyMappingsEntry(String key, String value) {
if (null == this.columnToJsonKeyMappings) {
this.columnToJsonKeyMappings = new java.util.HashMap();
}
if (this.columnToJsonKeyMappings.containsKey(key))
throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
this.columnToJsonKeyMappings.put(key, value);
return this;
}
/**
* Removes all the entries added into ColumnToJsonKeyMappings.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public OpenXJsonSerDe clearColumnToJsonKeyMappingsEntries() {
this.columnToJsonKeyMappings = null;
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getConvertDotsInJsonKeysToUnderscores() != null)
sb.append("ConvertDotsInJsonKeysToUnderscores: ").append(getConvertDotsInJsonKeysToUnderscores()).append(",");
if (getCaseInsensitive() != null)
sb.append("CaseInsensitive: ").append(getCaseInsensitive()).append(",");
if (getColumnToJsonKeyMappings() != null)
sb.append("ColumnToJsonKeyMappings: ").append(getColumnToJsonKeyMappings());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof OpenXJsonSerDe == false)
return false;
OpenXJsonSerDe other = (OpenXJsonSerDe) obj;
if (other.getConvertDotsInJsonKeysToUnderscores() == null ^ this.getConvertDotsInJsonKeysToUnderscores() == null)
return false;
if (other.getConvertDotsInJsonKeysToUnderscores() != null
&& other.getConvertDotsInJsonKeysToUnderscores().equals(this.getConvertDotsInJsonKeysToUnderscores()) == false)
return false;
if (other.getCaseInsensitive() == null ^ this.getCaseInsensitive() == null)
return false;
if (other.getCaseInsensitive() != null && other.getCaseInsensitive().equals(this.getCaseInsensitive()) == false)
return false;
if (other.getColumnToJsonKeyMappings() == null ^ this.getColumnToJsonKeyMappings() == null)
return false;
if (other.getColumnToJsonKeyMappings() != null && other.getColumnToJsonKeyMappings().equals(this.getColumnToJsonKeyMappings()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getConvertDotsInJsonKeysToUnderscores() == null) ? 0 : getConvertDotsInJsonKeysToUnderscores().hashCode());
hashCode = prime * hashCode + ((getCaseInsensitive() == null) ? 0 : getCaseInsensitive().hashCode());
hashCode = prime * hashCode + ((getColumnToJsonKeyMappings() == null) ? 0 : getColumnToJsonKeyMappings().hashCode());
return hashCode;
}
@Override
public OpenXJsonSerDe clone() {
try {
return (OpenXJsonSerDe) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.kinesisfirehose.model.transform.OpenXJsonSerDeMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}