All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.iotdataplane.model.PublishRequest Maven / Gradle / Ivy

Go to download

The AWS Java SDK for AWS Iot Data Plane Service module holds the client classes that are used for communicating with AWS IoT Data Plane Service

The newest version!
/*
 * Copyright 2013-2018 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 software.amazon.awssdk.services.iotdataplane.model;

import java.nio.ByteBuffer;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Consumer;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkBytes;
import software.amazon.awssdk.core.adapter.StandardMemberCopier;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* The input for the Publish operation. *

*/ @Generated("software.amazon.awssdk:codegen") public final class PublishRequest extends IotDataPlaneRequest implements ToCopyableBuilder { private final String topic; private final Integer qos; private final SdkBytes payload; private PublishRequest(BuilderImpl builder) { super(builder); this.topic = builder.topic; this.qos = builder.qos; this.payload = builder.payload; } /** *

* The name of the MQTT topic. *

* * @return The name of the MQTT topic. */ public String topic() { return topic; } /** *

* The Quality of Service (QoS) level. *

* * @return The Quality of Service (QoS) level. */ public Integer qos() { return qos; } /** *

* The state information, in JSON format. *

* * @return The state information, in JSON format. */ public SdkBytes payload() { return payload; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(topic()); hashCode = 31 * hashCode + Objects.hashCode(qos()); hashCode = 31 * hashCode + Objects.hashCode(payload()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof PublishRequest)) { return false; } PublishRequest other = (PublishRequest) obj; return Objects.equals(topic(), other.topic()) && Objects.equals(qos(), other.qos()) && Objects.equals(payload(), other.payload()); } @Override public String toString() { return ToString.builder("PublishRequest").add("Topic", topic()).add("Qos", qos()).add("Payload", payload()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "topic": return Optional.ofNullable(clazz.cast(topic())); case "qos": return Optional.ofNullable(clazz.cast(qos())); case "payload": return Optional.ofNullable(clazz.cast(payload())); default: return Optional.empty(); } } public interface Builder extends IotDataPlaneRequest.Builder, CopyableBuilder { /** *

* The name of the MQTT topic. *

* * @param topic * The name of the MQTT topic. * @return Returns a reference to this object so that method calls can be chained together. */ Builder topic(String topic); /** *

* The Quality of Service (QoS) level. *

* * @param qos * The Quality of Service (QoS) level. * @return Returns a reference to this object so that method calls can be chained together. */ Builder qos(Integer qos); /** *

* The state information, in JSON format. *

* * @param payload * The state information, in JSON format. * @return Returns a reference to this object so that method calls can be chained together. */ Builder payload(SdkBytes payload); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends IotDataPlaneRequest.BuilderImpl implements Builder { private String topic; private Integer qos; private SdkBytes payload; private BuilderImpl() { } private BuilderImpl(PublishRequest model) { super(model); topic(model.topic); qos(model.qos); payload(model.payload); } public final String getTopic() { return topic; } @Override public final Builder topic(String topic) { this.topic = topic; return this; } public final void setTopic(String topic) { this.topic = topic; } public final Integer getQos() { return qos; } @Override public final Builder qos(Integer qos) { this.qos = qos; return this; } public final void setQos(Integer qos) { this.qos = qos; } public final ByteBuffer getPayload() { return payload == null ? null : payload.asByteBuffer(); } @Override public final Builder payload(SdkBytes payload) { this.payload = StandardMemberCopier.copy(payload); return this; } public final void setPayload(ByteBuffer payload) { payload(payload == null ? null : SdkBytes.fromByteBuffer(payload)); } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public PublishRequest build() { return new PublishRequest(this); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy