Package org.eclipse.hono.adapter.mqtt
Class PropertyBag
- java.lang.Object
-
- org.eclipse.hono.adapter.mqtt.PropertyBag
-
public final class PropertyBag extends Object
A collection of methods for processing a property-bag set at the end of a topic.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PropertyBagfromTopic(String topic)Creates a property bag object from a topic.Iterator<Map.Entry<String,String>>getPropertiesIterator()Gets an iterator iterating over the properties.StringgetProperty(String name)Gets a property value from the property-bag.org.eclipse.hono.util.ResourceIdentifiertopicWithoutPropertyBag()Returns the topic without the property-bag.
-
-
-
Method Detail
-
fromTopic
public static PropertyBag fromTopic(String topic)
Creates a property bag object from a topic.The properties are retrieved from the topic by means of parsing the topic after the last occurrence of /? as an HTTP query string.
Note: The given topic must have a non-empty first path segment, otherwise
nullwill be returned.- Parameters:
topic- The topic that the message has been published to.- Returns:
- The property bag (which may have no properties) or
nullif the topic path is empty or has an empty first segment or the property bag part is invalid. - Throws:
NullPointerException- if topic isnull.
-
getProperty
public String getProperty(String name)
Gets a property value from the property-bag.The case sensitivity of the property names are ignored while fetching a property value.
- Parameters:
name- The property name.- Returns:
- The property value or
nullif the property is not set.
-
getPropertiesIterator
public Iterator<Map.Entry<String,String>> getPropertiesIterator()
Gets an iterator iterating over the properties.- Returns:
- The properties iterator.
-
topicWithoutPropertyBag
public org.eclipse.hono.util.ResourceIdentifier topicWithoutPropertyBag()
Returns the topic without the property-bag.- Returns:
- The topic without the property-bag.
-
-