Package org.eclipse.hono.util
Class CommandEndpoint
java.lang.Object
org.eclipse.hono.util.CommandEndpoint
Encapsulates the command endpoint information for a device as defined by the
Device Registration API.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetFormattedUri
(String deviceId) Returns the configured uri formatted with the deviceId.Gets headers to be used when sending a command to this endpoint.Gets payload properties to be used when sending a command to this endpoint.getUri()
Gets the URI to be used when sending a command to this endpoint.boolean
Checks whether the configured uri is valid.setHeaders
(Map<String, String> headers) Sets headers to be used when sending a command to this endpoint.setPayloadProperties
(Map<String, String> payloadProperties) Sets payload properties to be used when sending a command to this endpoint.Sets the URI to be used when sending a command to this endpoint.
-
Constructor Details
-
CommandEndpoint
public CommandEndpoint()
-
-
Method Details
-
getUri
Gets the URI to be used when sending a command to this endpoint.Note that the URI may contain the {{deviceId}} placeholder.
- Returns:
- The URI or
null
if not set.
-
setUri
Sets the URI to be used when sending a command to this endpoint.The URI may contain the {{deviceId}} placeholder.
- Parameters:
uri
- The URI to set ornull
.- Returns:
- A reference to this object for method chaining.
-
getHeaders
Gets headers to be used when sending a command to this endpoint.- Returns:
- An unmodifiable view on the headers.
-
setHeaders
Sets headers to be used when sending a command to this endpoint.- Parameters:
headers
- The headers to set ornull
to clear all headers.- Returns:
- A reference to this object for method chaining.
-
getPayloadProperties
Gets payload properties to be used when sending a command to this endpoint.- Returns:
- An unmodifiable view on the payload properties.
-
setPayloadProperties
Sets payload properties to be used when sending a command to this endpoint.- Parameters:
payloadProperties
- The payload properties to set ornull
to clear all payload properties.- Returns:
- A reference to this object for method chaining.
-
isUriValid
public boolean isUriValid()Checks whether the configured uri is valid.- Returns:
- true when the uri is not null and the uri can be converted without exceptions.
-
getFormattedUri
Returns the configured uri formatted with the deviceId.- Parameters:
deviceId
- The deviceId to replace the placeholder with in the configured uri.- Returns:
- the fully formatted uri.
- Throws:
NullPointerException
- If deviceId isnull
.
-