/* * Copyright 2010-2023 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.iot.model; import java.io.Serializable; /** *

* Specifies MQTT Version 5.0 headers information. For more information, see * MQTT from Amazon Web Services IoT Core Developer Guide. *

*/ public class MqttHeaders implements Serializable { /** *

* An Enum string value that indicates whether the payload is * formatted as UTF-8. *

*

* Valid values are UNSPECIFIED_BYTES and * UTF8_DATA. *

*

* For more information, see Payload Format Indicator from the MQTT Version 5.0 specification. *

*

* Supports substitution templates. *

*

* Constraints:
* Length: 0 - 1024
*/ private String payloadFormatIndicator; /** *

* A UTF-8 encoded string that describes the content of the publishing * message. *

*

* For more information, see Content Type from the MQTT Version 5.0 specification. *

*

* Supports substitution templates. *

*

* Constraints:
* Length: 0 - 1024
*/ private String contentType; /** *

* A UTF-8 encoded string that's used as the topic name for a response * message. The response topic is used to describe the topic which the * receiver should publish to as part of the request-response flow. The * topic must not contain wildcard characters. *

*

* For more information, see Response Topic from the MQTT Version 5.0 specification. *

*

* Supports substitution templates. *

*

* Constraints:
* Length: 0 - 1024
*/ private String responseTopic; /** *

* The base64-encoded binary data used by the sender of the request message * to identify which request the response message is for when it's received. *

*

* For more information, see Correlation Data from the MQTT Version 5.0 specification. *

* *

* This binary data must be based64-encoded. *

*
*

* Supports substitution templates. *

*

* Constraints:
* Length: 0 - 1024
*/ private String correlationData; /** *

* A user-defined integer value that will persist a message at the message * broker for a specified amount of time to ensure that the message will * expire if it's no longer relevant to the subscriber. The value of * messageExpiry represents the number of seconds before it * expires. For more information about the limits of * messageExpiry, see Amazon Web Services IoT Core message broker and protocol limits and * quotas from the Amazon Web Services Reference Guide. *

*

* Supports substitution templates. *

*

* Constraints:
* Length: 0 - 1024
*/ private String messageExpiry; /** *

* An array of key-value pairs that you define in the MQTT5 header. *

*/ private java.util.List userProperties; /** *

* An Enum string value that indicates whether the payload is * formatted as UTF-8. *

*

* Valid values are UNSPECIFIED_BYTES and * UTF8_DATA. *

*

* For more information, see Payload Format Indicator from the MQTT Version 5.0 specification. *

*

* Supports substitution templates. *

*

* Constraints:
* Length: 0 - 1024
* * @return

* An Enum string value that indicates whether the * payload is formatted as UTF-8. *

*

* Valid values are UNSPECIFIED_BYTES and * UTF8_DATA. *

*

* For more information, see Payload Format Indicator from the MQTT Version 5.0 * specification. *

*

* Supports substitution templates. *

*/ public String getPayloadFormatIndicator() { return payloadFormatIndicator; } /** *

* An Enum string value that indicates whether the payload is * formatted as UTF-8. *

*

* Valid values are UNSPECIFIED_BYTES and * UTF8_DATA. *

*

* For more information, see Payload Format Indicator from the MQTT Version 5.0 specification. *

*

* Supports substitution templates. *

*

* Constraints:
* Length: 0 - 1024
* * @param payloadFormatIndicator

* An Enum string value that indicates whether the * payload is formatted as UTF-8. *

*

* Valid values are UNSPECIFIED_BYTES and * UTF8_DATA. *

*

* For more information, see Payload Format Indicator from the MQTT Version 5.0 * specification. *

*

* Supports substitution templates. *

*/ public void setPayloadFormatIndicator(String payloadFormatIndicator) { this.payloadFormatIndicator = payloadFormatIndicator; } /** *

* An Enum string value that indicates whether the payload is * formatted as UTF-8. *

*

* Valid values are UNSPECIFIED_BYTES and * UTF8_DATA. *

*

* For more information, see Payload Format Indicator from the MQTT Version 5.0 specification. *

*

* Supports substitution templates. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Length: 0 - 1024
* * @param payloadFormatIndicator

* An Enum string value that indicates whether the * payload is formatted as UTF-8. *

*

* Valid values are UNSPECIFIED_BYTES and * UTF8_DATA. *

*

* For more information, see Payload Format Indicator from the MQTT Version 5.0 * specification. *

*

* Supports substitution templates. *

* @return A reference to this updated object so that method calls can be * chained together. */ public MqttHeaders withPayloadFormatIndicator(String payloadFormatIndicator) { this.payloadFormatIndicator = payloadFormatIndicator; return this; } /** *

* A UTF-8 encoded string that describes the content of the publishing * message. *

*

* For more information, see Content Type from the MQTT Version 5.0 specification. *

*

* Supports substitution templates. *

*

* Constraints:
* Length: 0 - 1024
* * @return

* A UTF-8 encoded string that describes the content of the * publishing message. *

*

* For more information, see Content Type from the MQTT Version 5.0 specification. *

*

* Supports substitution templates. *

*/ public String getContentType() { return contentType; } /** *

* A UTF-8 encoded string that describes the content of the publishing * message. *

*

* For more information, see Content Type from the MQTT Version 5.0 specification. *

*

* Supports substitution templates. *

*

* Constraints:
* Length: 0 - 1024
* * @param contentType

* A UTF-8 encoded string that describes the content of the * publishing message. *

*

* For more information, see Content Type from the MQTT Version 5.0 specification. *

*

* Supports substitution templates. *

*/ public void setContentType(String contentType) { this.contentType = contentType; } /** *

* A UTF-8 encoded string that describes the content of the publishing * message. *

*

* For more information, see Content Type from the MQTT Version 5.0 specification. *

*

* Supports substitution templates. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Length: 0 - 1024
* * @param contentType

* A UTF-8 encoded string that describes the content of the * publishing message. *

*

* For more information, see Content Type from the MQTT Version 5.0 specification. *

*

* Supports substitution templates. *

* @return A reference to this updated object so that method calls can be * chained together. */ public MqttHeaders withContentType(String contentType) { this.contentType = contentType; return this; } /** *

* A UTF-8 encoded string that's used as the topic name for a response * message. The response topic is used to describe the topic which the * receiver should publish to as part of the request-response flow. The * topic must not contain wildcard characters. *

*

* For more information, see Response Topic from the MQTT Version 5.0 specification. *

*

* Supports substitution templates. *

*

* Constraints:
* Length: 0 - 1024
* * @return

* A UTF-8 encoded string that's used as the topic name for a * response message. The response topic is used to describe the * topic which the receiver should publish to as part of the * request-response flow. The topic must not contain wildcard * characters. *

*

* For more information, see Response Topic from the MQTT Version 5.0 specification. *

*

* Supports substitution templates. *

*/ public String getResponseTopic() { return responseTopic; } /** *

* A UTF-8 encoded string that's used as the topic name for a response * message. The response topic is used to describe the topic which the * receiver should publish to as part of the request-response flow. The * topic must not contain wildcard characters. *

*

* For more information, see Response Topic from the MQTT Version 5.0 specification. *

*

* Supports substitution templates. *

*

* Constraints:
* Length: 0 - 1024
* * @param responseTopic

* A UTF-8 encoded string that's used as the topic name for a * response message. The response topic is used to describe the * topic which the receiver should publish to as part of the * request-response flow. The topic must not contain wildcard * characters. *

*

* For more information, see Response Topic from the MQTT Version 5.0 specification. *

*

* Supports substitution templates. *

*/ public void setResponseTopic(String responseTopic) { this.responseTopic = responseTopic; } /** *

* A UTF-8 encoded string that's used as the topic name for a response * message. The response topic is used to describe the topic which the * receiver should publish to as part of the request-response flow. The * topic must not contain wildcard characters. *

*

* For more information, see Response Topic from the MQTT Version 5.0 specification. *

*

* Supports substitution templates. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Length: 0 - 1024
* * @param responseTopic

* A UTF-8 encoded string that's used as the topic name for a * response message. The response topic is used to describe the * topic which the receiver should publish to as part of the * request-response flow. The topic must not contain wildcard * characters. *

*

* For more information, see Response Topic from the MQTT Version 5.0 specification. *

*

* Supports substitution templates. *

* @return A reference to this updated object so that method calls can be * chained together. */ public MqttHeaders withResponseTopic(String responseTopic) { this.responseTopic = responseTopic; return this; } /** *

* The base64-encoded binary data used by the sender of the request message * to identify which request the response message is for when it's received. *

*

* For more information, see Correlation Data from the MQTT Version 5.0 specification. *

* *

* This binary data must be based64-encoded. *

*
*

* Supports substitution templates. *

*

* Constraints:
* Length: 0 - 1024
* * @return

* The base64-encoded binary data used by the sender of the request * message to identify which request the response message is for * when it's received. *

*

* For more information, see Correlation Data from the MQTT Version 5.0 specification. *

* *

* This binary data must be based64-encoded. *

*
*

* Supports substitution templates. *

*/ public String getCorrelationData() { return correlationData; } /** *

* The base64-encoded binary data used by the sender of the request message * to identify which request the response message is for when it's received. *

*

* For more information, see Correlation Data from the MQTT Version 5.0 specification. *

* *

* This binary data must be based64-encoded. *

*
*

* Supports substitution templates. *

*

* Constraints:
* Length: 0 - 1024
* * @param correlationData

* The base64-encoded binary data used by the sender of the * request message to identify which request the response message * is for when it's received. *

*

* For more information, see Correlation Data from the MQTT Version 5.0 * specification. *

* *

* This binary data must be based64-encoded. *

*
*

* Supports substitution templates. *

*/ public void setCorrelationData(String correlationData) { this.correlationData = correlationData; } /** *

* The base64-encoded binary data used by the sender of the request message * to identify which request the response message is for when it's received. *

*

* For more information, see Correlation Data from the MQTT Version 5.0 specification. *

* *

* This binary data must be based64-encoded. *

*
*

* Supports substitution templates. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Length: 0 - 1024
* * @param correlationData

* The base64-encoded binary data used by the sender of the * request message to identify which request the response message * is for when it's received. *

*

* For more information, see Correlation Data from the MQTT Version 5.0 * specification. *

* *

* This binary data must be based64-encoded. *

*
*

* Supports substitution templates. *

* @return A reference to this updated object so that method calls can be * chained together. */ public MqttHeaders withCorrelationData(String correlationData) { this.correlationData = correlationData; return this; } /** *

* A user-defined integer value that will persist a message at the message * broker for a specified amount of time to ensure that the message will * expire if it's no longer relevant to the subscriber. The value of * messageExpiry represents the number of seconds before it * expires. For more information about the limits of * messageExpiry, see Amazon Web Services IoT Core message broker and protocol limits and * quotas from the Amazon Web Services Reference Guide. *

*

* Supports substitution templates. *

*

* Constraints:
* Length: 0 - 1024
* * @return

* A user-defined integer value that will persist a message at the * message broker for a specified amount of time to ensure that the * message will expire if it's no longer relevant to the subscriber. * The value of messageExpiry represents the number of * seconds before it expires. For more information about the limits * of messageExpiry, see Amazon Web Services IoT Core message broker and protocol limits * and quotas from the Amazon Web Services Reference Guide. *

*

* Supports substitution templates. *

*/ public String getMessageExpiry() { return messageExpiry; } /** *

* A user-defined integer value that will persist a message at the message * broker for a specified amount of time to ensure that the message will * expire if it's no longer relevant to the subscriber. The value of * messageExpiry represents the number of seconds before it * expires. For more information about the limits of * messageExpiry, see Amazon Web Services IoT Core message broker and protocol limits and * quotas from the Amazon Web Services Reference Guide. *

*

* Supports substitution templates. *

*

* Constraints:
* Length: 0 - 1024
* * @param messageExpiry

* A user-defined integer value that will persist a message at * the message broker for a specified amount of time to ensure * that the message will expire if it's no longer relevant to the * subscriber. The value of messageExpiry represents * the number of seconds before it expires. For more information * about the limits of messageExpiry, see Amazon Web Services IoT Core message broker and protocol * limits and quotas from the Amazon Web Services Reference * Guide. *

*

* Supports substitution templates. *

*/ public void setMessageExpiry(String messageExpiry) { this.messageExpiry = messageExpiry; } /** *

* A user-defined integer value that will persist a message at the message * broker for a specified amount of time to ensure that the message will * expire if it's no longer relevant to the subscriber. The value of * messageExpiry represents the number of seconds before it * expires. For more information about the limits of * messageExpiry, see Amazon Web Services IoT Core message broker and protocol limits and * quotas from the Amazon Web Services Reference Guide. *

*

* Supports substitution templates. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Length: 0 - 1024
* * @param messageExpiry

* A user-defined integer value that will persist a message at * the message broker for a specified amount of time to ensure * that the message will expire if it's no longer relevant to the * subscriber. The value of messageExpiry represents * the number of seconds before it expires. For more information * about the limits of messageExpiry, see Amazon Web Services IoT Core message broker and protocol * limits and quotas from the Amazon Web Services Reference * Guide. *

*

* Supports substitution templates. *

* @return A reference to this updated object so that method calls can be * chained together. */ public MqttHeaders withMessageExpiry(String messageExpiry) { this.messageExpiry = messageExpiry; return this; } /** *

* An array of key-value pairs that you define in the MQTT5 header. *

* * @return

* An array of key-value pairs that you define in the MQTT5 header. *

*/ public java.util.List getUserProperties() { return userProperties; } /** *

* An array of key-value pairs that you define in the MQTT5 header. *

* * @param userProperties

* An array of key-value pairs that you define in the MQTT5 * header. *

*/ public void setUserProperties(java.util.Collection userProperties) { if (userProperties == null) { this.userProperties = null; return; } this.userProperties = new java.util.ArrayList(userProperties); } /** *

* An array of key-value pairs that you define in the MQTT5 header. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param userProperties

* An array of key-value pairs that you define in the MQTT5 * header. *

* @return A reference to this updated object so that method calls can be * chained together. */ public MqttHeaders withUserProperties(UserProperty... userProperties) { if (getUserProperties() == null) { this.userProperties = new java.util.ArrayList(userProperties.length); } for (UserProperty value : userProperties) { this.userProperties.add(value); } return this; } /** *

* An array of key-value pairs that you define in the MQTT5 header. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param userProperties

* An array of key-value pairs that you define in the MQTT5 * header. *

* @return A reference to this updated object so that method calls can be * chained together. */ public MqttHeaders withUserProperties(java.util.Collection userProperties) { setUserProperties(userProperties); return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getPayloadFormatIndicator() != null) sb.append("payloadFormatIndicator: " + getPayloadFormatIndicator() + ","); if (getContentType() != null) sb.append("contentType: " + getContentType() + ","); if (getResponseTopic() != null) sb.append("responseTopic: " + getResponseTopic() + ","); if (getCorrelationData() != null) sb.append("correlationData: " + getCorrelationData() + ","); if (getMessageExpiry() != null) sb.append("messageExpiry: " + getMessageExpiry() + ","); if (getUserProperties() != null) sb.append("userProperties: " + getUserProperties()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getPayloadFormatIndicator() == null) ? 0 : getPayloadFormatIndicator() .hashCode()); hashCode = prime * hashCode + ((getContentType() == null) ? 0 : getContentType().hashCode()); hashCode = prime * hashCode + ((getResponseTopic() == null) ? 0 : getResponseTopic().hashCode()); hashCode = prime * hashCode + ((getCorrelationData() == null) ? 0 : getCorrelationData().hashCode()); hashCode = prime * hashCode + ((getMessageExpiry() == null) ? 0 : getMessageExpiry().hashCode()); hashCode = prime * hashCode + ((getUserProperties() == null) ? 0 : getUserProperties().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof MqttHeaders == false) return false; MqttHeaders other = (MqttHeaders) obj; if (other.getPayloadFormatIndicator() == null ^ this.getPayloadFormatIndicator() == null) return false; if (other.getPayloadFormatIndicator() != null && other.getPayloadFormatIndicator().equals(this.getPayloadFormatIndicator()) == false) return false; if (other.getContentType() == null ^ this.getContentType() == null) return false; if (other.getContentType() != null && other.getContentType().equals(this.getContentType()) == false) return false; if (other.getResponseTopic() == null ^ this.getResponseTopic() == null) return false; if (other.getResponseTopic() != null && other.getResponseTopic().equals(this.getResponseTopic()) == false) return false; if (other.getCorrelationData() == null ^ this.getCorrelationData() == null) return false; if (other.getCorrelationData() != null && other.getCorrelationData().equals(this.getCorrelationData()) == false) return false; if (other.getMessageExpiry() == null ^ this.getMessageExpiry() == null) return false; if (other.getMessageExpiry() != null && other.getMessageExpiry().equals(this.getMessageExpiry()) == false) return false; if (other.getUserProperties() == null ^ this.getUserProperties() == null) return false; if (other.getUserProperties() != null && other.getUserProperties().equals(this.getUserProperties()) == false) return false; return true; } }