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

com.arm.mbed.cloud.sdk.security.model.ServerCredentials Maven / Gradle / Ivy

// This file was generated by the Pelion SDK foundation code generator.
// This is an autogenerated class. Do not modify its content as modifications will be lost at next code generation.
package com.arm.mbed.cloud.sdk.security.model;

import com.arm.mbed.cloud.sdk.annotations.Internal;
import com.arm.mbed.cloud.sdk.annotations.Preamble;
import com.arm.mbed.cloud.sdk.common.SdkModel;
import java.util.Date;

/**
 * Model for a server credentials.
 */
@Preamble(description = "Model for a server credentials.")
public class ServerCredentials implements SdkModel {
    /**
     * Serialisation Id.
     */
    private static final long serialVersionUID = 2078127543195182L;

    /**
     * Creation UTC time RFC3339.
     */
    private final Date createdAt;

    /**
     * Unique entity ID.
     */
    private String id;

    /**
     * PEM-format X.509 server certificate used to validate the server certificate received during the TLS/DTLS
     * handshake.
     */
    private final String serverCertificate;

    /**
     * Server URI that the client connects to.
     */
    private final String serverUri;

    /**
     * Internal constructor.
     *
     * 

* Constructor based on all fields. *

* Note: Should not be used. Use {@link #ServerCredentials()} instead. * * @param createdAt * Creation UTC time RFC3339. * @param id * Unique entity ID. * @param serverCertificate * PEM-format X.509 server certificate used to validate the server certificate received during the * TLS/DTLS handshake. * @param serverUri * Server URI that the client connects to. */ @Internal public ServerCredentials(Date createdAt, String id, String serverCertificate, String serverUri) { super(); this.createdAt = createdAt; this.serverCertificate = serverCertificate; this.serverUri = serverUri; setId(id); } /** * Internal constructor. * *

* Constructor based on a similar object. *

* Note: Should not be used. Use {@link #ServerCredentials()} instead. * * @param serverCredentials * a server credentials. */ @Internal public ServerCredentials(ServerCredentials serverCredentials) { this(serverCredentials == null ? new Date() : serverCredentials.createdAt, serverCredentials == null ? (String) null : serverCredentials.id, serverCredentials == null ? (String) null : serverCredentials.serverCertificate, serverCredentials == null ? (String) null : serverCredentials.serverUri); } /** * Constructor. */ public ServerCredentials() { this(new Date(), (String) null, (String) null, (String) null); } /** * Constructor. * *

* Constructor based on object identifier. *

* * @param id * Unique entity ID. */ public ServerCredentials(String id) { this(); setId(id); } /** * Internal constructor. * *

* Constructor based on read-only fields. *

* Note: Should not be used. Use {@link #ServerCredentials()} instead. * * @param createdAt * Creation UTC time RFC3339. * @param serverCertificate * PEM-format X.509 server certificate used to validate the server certificate received during the * TLS/DTLS handshake. * @param serverUri * Server URI that the client connects to. */ @Internal public ServerCredentials(Date createdAt, String serverCertificate, String serverUri) { this(createdAt, (String) null, serverCertificate, serverUri); } /** * Gets creation utc time rfc3339. * * @return createdAt */ public Date getCreatedAt() { return createdAt; } /** * Gets unique entity id. * * @return id */ @Override public String getId() { return id; } /** * Sets unique entity id. * * @param id * Unique entity ID. */ @Override public void setId(String id) { this.id = id; } /** * Sets unique entity id. * *

* Similar to {@link #setId(String)} * * @param serverCredentialsId * Unique entity ID. */ @Internal public void setServerCredentialsId(String serverCredentialsId) { setId(serverCredentialsId); } /** * Gets pem-format x.509 server certificate used to validate the server certificate received during the tls/dtls * handshake. * * @return serverCertificate */ public String getServerCertificate() { return serverCertificate; } /** * Gets server uri that the client connects to. * * @return serverUri */ public String getServerUri() { return serverUri; } /** * Returns a string representation of the object. * *

* * @see java.lang.Object#toString() * @return the string representation */ @Override public String toString() { return "ServerCredentials [createdAt=" + createdAt + ", id=" + id + ", serverCertificate=" + serverCertificate + ", serverUri=" + serverUri + "]"; } /** * Calculates the hash code of this instance based on field values. * *

* * @see java.lang.Object#hashCode() * @return hash code */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((createdAt == null) ? 0 : createdAt.hashCode()); result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((serverCertificate == null) ? 0 : serverCertificate.hashCode()); result = prime * result + ((serverUri == null) ? 0 : serverUri.hashCode()); return result; } /** * Method to ensure {@link #equals(Object)} is correct. * *

* Note: see this article: canEqual() * * @param other * another object. * @return true if the other object is an instance of the class in which canEqual is (re)defined, false otherwise. */ protected boolean canEqual(Object other) { return other instanceof ServerCredentials; } /** * Indicates whether some other object is "equal to" this one. * *

* * @see java.lang.Object#equals(java.lang.Object) * @param obj * an object to compare with this instance. * @return true if this object is the same as the obj argument; false otherwise. */ @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof ServerCredentials)) { return false; } final ServerCredentials other = (ServerCredentials) obj; if (!other.canEqual(this)) { return false; } if (createdAt == null) { if (other.createdAt != null) { return false; } } else if (!createdAt.equals(other.createdAt)) { return false; } if (id == null) { if (other.id != null) { return false; } } else if (!id.equals(other.id)) { return false; } if (serverCertificate == null) { if (other.serverCertificate != null) { return false; } } else if (!serverCertificate.equals(other.serverCertificate)) { return false; } if (serverUri == null) { if (other.serverUri != null) { return false; } } else if (!serverUri.equals(other.serverUri)) { return false; } return true; } /** * Checks whether the model is valid or not. * *

* * @see SdkModel#isValid() * @return true if the model is valid; false otherwise. */ @Override public boolean isValid() { return true; } /** * Clones this instance. * *

* * @see java.lang.Object#clone() * @return a cloned instance */ @Override public ServerCredentials clone() { return new ServerCredentials(this); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy