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

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

Go to download

The Pelion Cloud SDK (formerly known as Mbed Cloud SDK) provides a simplified interface to the Pelion Cloud APIs by exposing functionality using conventions and paradigms familiar to Java developers.

There is a newer version: 2.5.0
Show newest version
// This file was generated by the Pelion SDK foundation code generator.
// This model class was autogenerated on Thu May 02 18:55:00 BST 2019. Feel free to change its contents as you wish.
package com.arm.mbed.cloud.sdk.security.model;

import java.util.Date;

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

/**
 * Model for a pre shared key.
 */
@Preamble(description = "Model for a pre shared key.")
public class PreSharedKey extends AbstractPreSharedKey {
    /**
     * Serialisation Id.
     */
    private static final long serialVersionUID = 1784667797161851L;
    /**
     * The ID of the pre-shared key.
     */
    private String id;

    /**
     * Internal constructor.
     * 
     * 

* Constructor based on all fields. *

* Note: Should not be used. Use {@link #PreSharedKey()} instead. * * @param endpointName * The unique endpoint identifier that this PSK applies to. 16-64 * [printable](https://en.wikipedia.org/wiki/ASCII#Printable_characters) (non-control) ASCII characters. * @param id * The Id of the pre_shared_key, shadows the endpoint_name. * @param createdAt * The date-time (RFC3339) when this PSK was uploaded to Device Management. */ @Internal public PreSharedKey(String endpointName, String id, Date createdAt) { super(createdAt); setEndpointName(endpointName); setId(id); } /** * Internal constructor. * *

* Constructor based on a similar object. *

* Note: Should not be used. Use {@link #PreSharedKey()} instead. * * @param preSharedKey * a pre shared key. */ @Internal public PreSharedKey(PreSharedKey preSharedKey) { this(preSharedKey == null ? (String) null : preSharedKey.getEndpointName(), preSharedKey == null ? (String) null : preSharedKey.getId(), preSharedKey == null ? new Date() : preSharedKey.createdAt); } /** * Constructor. */ public PreSharedKey() { this((String) null, (String) null, new Date()); } /** * Constructor. * *

* Constructor based on object identifier. *

* * @param id * The Id of the pre_shared_key, shadows the endpoint_name. */ public PreSharedKey(String id) { this(); setId(id); } /** * Internal constructor. * *

* Constructor based on read-only fields. *

* Note: Should not be used. Use {@link #PreSharedKey()} instead. * * @param createdAt * The date-time (RFC3339) when this PSK was uploaded to Device Management. */ @Internal public PreSharedKey(Date createdAt) { this((String) null, (String) null, createdAt); } /** * Gets the unique endpoint identifier that this psk applies to. 16-64 * [printable](https://en.wikipedia.org/wiki/ascii#printable_characters) (non-control) ascii characters. * * @return endpointName */ public String getEndpointName() { return getId(); } /** * Sets the unique endpoint identifier that this psk applies to. 16-64 * [printable](https://en.wikipedia.org/wiki/ascii#printable_characters) (non-control) ascii characters. * *

* Note: the length of the string has to match {@code /^[ -~]{16,64}$/} to be valid * * @param endpointName * The unique endpoint identifier that this PSK applies to. 16-64 * [printable](https://en.wikipedia.org/wiki/ASCII#Printable_characters) (non-control) ASCII characters. */ public void setEndpointName(String endpointName) { setId(endpointName); } /** * Checks whether endpointName value is valid. * * @return true if the value is valid; false otherwise. */ @SuppressWarnings("PMD.UselessParentheses") public boolean isEndpointNameValid() { return id != null && id.matches("^[ -~]{16,64}$"); } /** * Gets the id of the pre_shared_key, shadows the endpoint_name. * * @return id */ @Override public String getId() { return this.id; } /** * Sets the id of the pre_shared_key, shadows the endpoint_name. * * @param id * The Id of the pre_shared_key, shadows the endpoint_name. */ @Override public void setId(String id) { this.id = id; } /** * Sets the id of the pre_shared_key, shadows the endpoint_name. * *

* Similar to {@link #setId(String)} * * @param preSharedKeyId * The Id of the pre_shared_key, shadows the endpoint_name. */ @Internal public void setPreSharedKeyId(String preSharedKeyId) { setId(preSharedKeyId); } /** * Returns a string representation of the object. * *

* * @see java.lang.Object#toString() * @return the string representation */ @Override public String toString() { return "PreSharedKey [endpointName=" + getEndpointName() + ", id=" + getId() + ", createdAt=" + createdAt + "]"; } /** * 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 = super.hashCode(); result = prime * result + ((id == null) ? 0 : id.hashCode()); return result; } /** * 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 (!super.equals(obj)) { return false; } if (!(obj instanceof PreSharedKey)) { return false; } final PreSharedKey other = (PreSharedKey) obj; if (!other.canEqual(this)) { return false; } if (id == null) { if (other.id != null) { return false; } } else if (!id.equals(other.id)) { 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 isEndpointNameValid() && super.isValid(); } /** * Clones this instance. * *

* * @see java.lang.Object#clone() * @return a cloned instance */ @Override public PreSharedKey clone() { return new PreSharedKey(this); } /** * 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. */ @Override protected boolean canEqual(Object other) { return other instanceof PreSharedKey; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy