Skip to content

Javadoc cleanup #371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Feb 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ plugins {

allprojects {
repositories {
mavenLocal()
mavenCentral()
jcenter()
}
}

Expand Down Expand Up @@ -149,6 +147,11 @@ allprojects {
'-removeheaders': 'Private-Package')
}

javadoc {
options.encoding 'UTF-8'
exclude '**/internal/**'
}

task javadocJar(type: Jar) {
group 'documentation'
description 'Assembles a jar archive containing the javadoc.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void write(

if (msg instanceof MqttMessage) {
final MqttMessage message = (MqttMessage) msg;
final MqttMessageEncoder messageEncoder = encoders.get(message.getType().getCode());
final MqttMessageEncoder<?> messageEncoder = encoders.get(message.getType().getCode());
if (messageEncoder == null) {
throw new UnsupportedOperationException();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*/
public abstract class MqttMessageEncoders {

protected final @NotNull MqttMessageEncoder @NotNull [] encoders = new MqttMessageEncoder[16];
protected final @NotNull MqttMessageEncoder<?> @NotNull [] encoders = new MqttMessageEncoder[16];

/**
* Returns the corresponding encoder to the given MQTT message type code.
Expand All @@ -36,7 +36,7 @@ public abstract class MqttMessageEncoders {
* @return the corresponding decoder to the MQTT message type code or null if there is no encoder for the MQTT
* message type code.
*/
public final @Nullable MqttMessageEncoder get(final int code) {
public final @Nullable MqttMessageEncoder<?> get(final int code) {
if (code < 0 || code >= encoders.length) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ public enum MqttCommonReasonCode implements Mqtt5ReasonCode {
this.code = code;
}

/**
* @return the byte code of this Reason Code.
*/
@Override
public int getCode() {
return code;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,29 @@
*/
public enum Mqtt3ConnAckReturnCode implements Mqtt3ReturnCode {

/**
* The connection is accepted.
*/
SUCCESS,
/**
* The server does not support the version of the MQTT protocol requested by the client.
*/
UNSUPPORTED_PROTOCOL_VERSION,
/**
* The client identifier is formed correctly but is not accepted by the server.
*/
IDENTIFIER_REJECTED,
/**
* The MQTT service is not available.
*/
SERVER_UNAVAILABLE,
/**
* The server does not accept the user name or password specified by the client.
*/
BAD_USER_NAME_OR_PASSWORD,
/**
* The client is not authorized to connect.
*/
NOT_AUTHORIZED;

private static final @NotNull Mqtt3ConnAckReturnCode[] VALUES = values();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,23 @@
*/
public enum Mqtt3SubAckReturnCode implements Mqtt3ReturnCode {

/**
* The subscription is accepted and the maximum QoS sent will be QoS 0 (this might be a lower QoS than was
* requested).
*/
SUCCESS_MAXIMUM_QOS_0(0),
/**
* The subscription is accepted and the maximum QoS sent will be QoS 1 (this might be a lower QoS than was
* requested).
*/
SUCCESS_MAXIMUM_QOS_1(1),
/**
* The subscription is accepted and the maximum QoS sent will be QoS 2.
*/
SUCCESS_MAXIMUM_QOS_2(2),
/**
* The subscription failed.
*/
FAILURE(128);

private final int code;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,17 @@
*/
public enum Mqtt5AuthReasonCode implements Mqtt5ReasonCode {

/**
* Authentication is successful.
*/
SUCCESS(MqttCommonReasonCode.SUCCESS),
/**
* Continue the authentication with another step.
*/
CONTINUE_AUTHENTICATION(0x18),
/**
* Initiate a re-authentication.
*/
REAUTHENTICATE(0x19);

private final int code;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,93 @@
*/
public enum Mqtt5ConnAckReasonCode implements Mqtt5ReasonCode {

/**
* The connection is accepted.
*/
SUCCESS(MqttCommonReasonCode.SUCCESS),
/**
* The server either does not want to reveal the reason for the failure or none of the other reason codes apply.
*/
UNSPECIFIED_ERROR(MqttCommonReasonCode.UNSPECIFIED_ERROR),
/**
* The CONNECT packet could not be parsed correctly according to the MQTT specification.
*/
MALFORMED_PACKET(MqttCommonReasonCode.MALFORMED_PACKET),
/**
* The CONNECT packet contained data that is not allowed by the MQTT protocol.
*/
PROTOCOL_ERROR(MqttCommonReasonCode.PROTOCOL_ERROR),
/**
* The CONNECT packet is valid but is not accepted by the server.
*/
IMPLEMENTATION_SPECIFIC_ERROR(MqttCommonReasonCode.IMPLEMENTATION_SPECIFIC_ERROR),
/**
* The server does not support the version of the MQTT protocol requested by the client.
*/
UNSUPPORTED_PROTOCOL_VERSION(0x84),
/**
* The client identifier is formed correctly but is not accepted by the server.
*/
CLIENT_IDENTIFIER_NOT_VALID(0x85),
/**
* The server does not accept the user name or password specified by the client.
*/
BAD_USER_NAME_OR_PASSWORD(0x86),
/**
* The client is not authorized to connect.
*/
NOT_AUTHORIZED(MqttCommonReasonCode.NOT_AUTHORIZED),
/**
* The MQTT service is not available.
*/
SERVER_UNAVAILABLE(0x88),
/**
* The server is busy. Try again later.
*/
SERVER_BUSY(MqttCommonReasonCode.SERVER_BUSY),
/**
* This client has been banned by administrative action. Contact the server administrator.
*/
BANNED(0x8A),
/**
* The authentication method is not supported or does not match the authentication method currently in use.
*/
BAD_AUTHENTICATION_METHOD(MqttCommonReasonCode.BAD_AUTHENTICATION_METHOD),
/**
* The Will topic name is formed correctly but is not accepted by the server.
*/
TOPIC_NAME_INVALID(MqttCommonReasonCode.TOPIC_NAME_INVALID),
/**
* The CONNECT packet exceeded the maximum permissible size.
*/
PACKET_TOO_LARGE(MqttCommonReasonCode.PACKET_TOO_LARGE),
/**
* An implementation or administrative imposed limit has been exceeded.
*/
QUOTA_EXCEEDED(MqttCommonReasonCode.QUOTA_EXCEEDED),
/**
* The Will payload does not match the specified payload format indicator.
*/
PAYLOAD_FORMAT_INVALID(MqttCommonReasonCode.PAYLOAD_FORMAT_INVALID),
/**
* The server does not support retained messages, but the Will retain flag was set.
*/
RETAIN_NOT_SUPPORTED(MqttCommonReasonCode.RETAIN_NOT_SUPPORTED),
/**
* The server does not support the QoS of the Will.
*/
QOS_NOT_SUPPORTED(MqttCommonReasonCode.QOS_NOT_SUPPORTED),
/**
* The client should temporarily use another server.
*/
USE_ANOTHER_SERVER(MqttCommonReasonCode.USE_ANOTHER_SERVER),
/**
* The client should permanently use another server.
*/
SERVER_MOVED(MqttCommonReasonCode.SERVER_MOVED),
/**
* The connection rate limit has been exceeded.
*/
CONNECTION_RATE_EXCEEDED(MqttCommonReasonCode.CONNECTION_RATE_EXCEEDED);

private final int code;
Expand Down Expand Up @@ -85,8 +151,8 @@ public int getCode() {
* Returns the CONNACK Reason Code belonging to the given byte code.
*
* @param code the byte code.
* @return the CONNACK Reason Code belonging to the given byte code or null if the byte code is not a valid CONNACK
* Reason Code code.
* @return the CONNACK Reason Code belonging to the given byte code or <code>null</code> if the byte code is not a
* valid CONNACK Reason Code code.
*/
public static @Nullable Mqtt5ConnAckReasonCode fromCode(final int code) {
if (code == SUCCESS.code) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,35 +32,129 @@
*/
public enum Mqtt5DisconnectReasonCode implements Mqtt5ReasonCode {

/**
* Disconnect normally. The server must not publish the Will message.
*/
NORMAL_DISCONNECTION(0x00),
/**
* Disconnect normally. The server must also publish the Will message.
*/
DISCONNECT_WITH_WILL_MESSAGE(0x04),
/**
* The sender either does not want to reveal the reason for the disconnect or none of the other reason codes apply.
*/
UNSPECIFIED_ERROR(MqttCommonReasonCode.UNSPECIFIED_ERROR),
/**
* A packet could not be parsed correctly according to the MQTT specification.
*/
MALFORMED_PACKET(MqttCommonReasonCode.MALFORMED_PACKET),
/**
* A packet contained data that is not allowed by the MQTT protocol or is inconsistent with the state of the
* receiver.
*/
PROTOCOL_ERROR(MqttCommonReasonCode.PROTOCOL_ERROR),
/**
* A packet is valid but can not be processed by the implementation of the receiver.
*/
IMPLEMENTATION_SPECIFIC_ERROR(MqttCommonReasonCode.IMPLEMENTATION_SPECIFIC_ERROR),
/**
* The client is not authorized to perform a request.
*/
NOT_AUTHORIZED(MqttCommonReasonCode.NOT_AUTHORIZED),
/**
* The server is busy and can not continue processing requests from the client.
*/
SERVER_BUSY(MqttCommonReasonCode.SERVER_BUSY),
/**
* The server is shutting down.
*/
SERVER_SHUTTING_DOWN(0x8B),
/**
* The authentication method is not supported or does not match the authentication method currently in use.
*/
BAD_AUTHENTICATION_METHOD(MqttCommonReasonCode.BAD_AUTHENTICATION_METHOD),
/**
* The connection is closed because no packet has been received for 1.5 times the keep alive time.
*/
KEEP_ALIVE_TIMEOUT(0x8D),
/**
* Another client using the same client identifier has connected.
*/
SESSION_TAKEN_OVER(0x8E),
/**
* A packet contained a topic filter that is formed correctly but is not accepted by the server.
*/
TOPIC_FILTER_INVALID(MqttCommonReasonCode.TOPIC_FILTER_INVALID),
/**
* A packet contained a topic name that is formed correctly but is not accepted by the receiver.
*/
TOPIC_NAME_INVALID(MqttCommonReasonCode.TOPIC_NAME_INVALID),
/**
* The receiver has received more publications for which it has not sent PUBACK or PUBCOMP than allowed by the
* receive maximum it sent in the CONNECT or CONNACK packet.
*/
RECEIVE_MAXIMUM_EXCEEDED(0x93),
/**
* The receiver has received a PUBLISH packet containing a topic alias which is greater than the maximum topic alias
* it sent in the CONNECT or CONNACK packet.
*/
TOPIC_ALIAS_INVALID(0x94),
/**
* The receiver has received a packet with a greater size than allowed by the maximum packet size it sent in the
* CONNECT or CONNACK packet.
*/
PACKET_TOO_LARGE(MqttCommonReasonCode.PACKET_TOO_LARGE),
/**
* The received data rate is too high.
*/
MESSAGE_RATE_TOO_HIGH(0x96),
/**
* An implementation or administrative imposed limit has been exceeded.
*/
QUOTA_EXCEEDED(MqttCommonReasonCode.QUOTA_EXCEEDED),
/**
* The connection is closed due to an administrative action.
*/
ADMINISTRATIVE_ACTION(0x98),
/**
* A payload does not match the specified payload format indicator.
*/
PAYLOAD_FORMAT_INVALID(MqttCommonReasonCode.PAYLOAD_FORMAT_INVALID),
/**
* The server does not support retained messages.
*/
RETAIN_NOT_SUPPORTED(MqttCommonReasonCode.RETAIN_NOT_SUPPORTED),
/**
* The client specified a QoS greater than the maximum QoS the server sent in the CONNACK packet.
*/
QOS_NOT_SUPPORTED(MqttCommonReasonCode.QOS_NOT_SUPPORTED),
/**
* The client should temporarily use another server.
*/
USE_ANOTHER_SERVER(MqttCommonReasonCode.USE_ANOTHER_SERVER),
/**
* The client should permanently use another server.
*/
SERVER_MOVED(MqttCommonReasonCode.SERVER_MOVED),
/**
* The server does not support shared subscriptions.
*/
SHARED_SUBSCRIPTIONS_NOT_SUPPORTED(MqttCommonReasonCode.SHARED_SUBSCRIPTIONS_NOT_SUPPORTED),
/**
* The connection is closed because the connection rate is too high.
*/
CONNECTION_RATE_EXCEEDED(MqttCommonReasonCode.CONNECTION_RATE_EXCEEDED),
/**
* The maximum connection time authorized for this connection has been exceeded.
*/
MAXIMUM_CONNECT_TIME(0xA0),
/**
* The server does not support subscription identifiers.
*/
SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED(MqttCommonReasonCode.SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED),
/**
* The server does not support wildcard subscriptions.
*/
WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED(MqttCommonReasonCode.WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED);

private final int code;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@
*/
public enum Mqtt5PayloadFormatIndicator {

/**
* Payload consists of unspecified bytes.
*/
UNSPECIFIED,
/**
* Payload consists of UTF-8 encoded character data as defined by the Unicode specification and restated in RFC 3629.
*/
UTF_8;

/**
Expand Down
Loading