Class RequestResponseResult<T>

    • Constructor Detail

      • RequestResponseResult

        public RequestResponseResult​(int status,
                                     T payload,
                                     CacheDirective directive,
                                     org.apache.qpid.proton.amqp.messaging.ApplicationProperties applicationProperties)
        Creates a new result for a status code and payload.
        Parameters:
        status - The code indicating the outcome of processing the request.
        payload - The payload to convey to the sender of the request (may be null).
        directive - Restrictions regarding the caching of the payload by the receiver of the result (may be null).
        applicationProperties - Arbitrary properties conveyed in the response message's application-properties.
    • Method Detail

      • getStatus

        public final int getStatus()
        Gets the status code indicating the outcome of the request.
        Returns:
        The code.
      • getPayload

        public final T getPayload()
        Gets the payload to convey to the sender of the request.
        Returns:
        The payload.
      • getCacheDirective

        public final CacheDirective getCacheDirective()
        Gets the cache directive specifying how the payload of this response may be cached.
        Returns:
        The directive or null if not set.
      • getApplicationProperty

        public final <V> V getApplicationProperty​(String key,
                                                  Class<V> type)
        Gets the value of a property conveyed in this response message's application-properties.
        Type Parameters:
        V - The expected value type.
        Parameters:
        key - The key of the property.
        type - The expected value type.
        Returns:
        The value if it is of the expected type or null otherwise.
      • getApplicationProperties

        public final Map<String,​Object> getApplicationProperties()
        Gets read-only access to the response message's application-properties.
        Returns:
        The unmodifiable map of the application properties. Never returns null.
      • isOk

        public final boolean isOk()
        Checks if this result's status is OK.
        Returns:
        true if status == 200.
      • isNotFound

        public final boolean isNotFound()
        Checks if this result's status is Not Found.
        Returns:
        true if status == 404.
      • isError

        public final boolean isError()
        Checks if this result's status code represents an error.
        Returns:
        true if the result contains an error code.