Make MQTT property value publicly accessible (#10577)

Motivation:

There was no way to read MQTT properties outside of `io.netty.handler.codec.mqtt` package

Modification:

Expose `MqttProperties.MqttProperty` fields `value` and `propertyId` via public methods

Result:

It's possible to read MQTT properties now
This commit is contained in:
Paul Lysak 2020-09-16 08:56:17 +03:00 committed by GitHub
parent 95ce1b95ea
commit aa85ea9947
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -109,6 +109,11 @@ public final class MqttProperties {
return properties;
}
/**
* MQTT property base class
*
* @param <T> property type
*/
public abstract static class MqttProperty<T> {
final T value;
final int propertyId;
@ -117,6 +122,23 @@ public final class MqttProperties {
this.propertyId = propertyId;
this.value = value;
}
/**
* Get MQTT property value
*
* @return property value
*/
public T value() {
return value;
}
/**
* Get MQTT property ID
* @return property ID
*/
public int propertyId() {
return propertyId;
}
}
public static final class IntegerProperty extends MqttProperty<Integer> {