Class UserProperty

java.lang.Object
org.mqtt4j.hato.UserProperty

public final class UserProperty extends Object
An MQTT 5.0 User Property of a message: a name and a value that the application chooses. Both are MQTT UTF-8 strings of at most 65535 bytes and may be empty. A message keeps its User Properties in order and may repeat a name; brokers forward them in the same order. Two User Properties are equal when their names are equal and their values are equal.
  • Constructor Details

    • UserProperty

      public UserProperty(String name, String value)
      Validates both strings.
      Parameters:
      name - the property name
      value - the property value
      Throws:
      IllegalArgumentException -
      if either string contains U+0000 or an unpaired surrogate, or exceeds 65535 bytes
      in UTF-8
      
  • Method Details

    • name

      public String name()
      Returns the property name, possibly empty.
      Returns:
      the property name, possibly empty
    • value

      public String value()
      Returns the property value, possibly empty.
      Returns:
      the property value, possibly empty
    • equals

      public boolean equals(@Nullable Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object