Interface AttributeAware

All Known Subinterfaces:
HttpRequest, WebsocketConnection
All Known Implementing Classes:
DelayFuture, FailedFuture, FutureWork, ParallelFuture, SequencedFuture, UdevDevice, WebsocketClient

public interface AttributeAware
Interface for objects that can accumulate additional data in the form of attributes. For example, consider an HttpReqeust object where filters or interceptors may attach additional data to the request that can then be consumed later on by handlers. Consider attributes as public information riding with the AttributeAware object, almost like dynamic properties. This allows code written by one developer to pass data to code written by another developer via the AttributeAware object.

AttributeAware data is not expected to be serialized to json as it uses Object keys for maximum flexibility, but aren't compatible with json encoding. Similarly, there is no way to restrict the json view of the values. Consider using ClientAttributeAware for objects that need to expose attributes via json serialization.

Since:
1
Version:
1
  • Method Details

    • setAttribute

      void setAttribute(Object key, Object value)
      Sets the attribute for the given key.
      Parameters:
      key - the attribute key
      value - the attribute value
      Since:
      1
    • getAttribute

      Object getAttribute(Object key)
      Given a key, returns its attribute.
      Parameters:
      key - the attribute key
      Returns:
      the value of the attribute, or null if it doesn't exist
      Since:
      1
    • removeAttribute

      Object removeAttribute(Object key)
      Given a key, removes the attribute.
      Parameters:
      key - the attribute key
      Returns:
      the value of the attribute being removed, or null if it didn't exist
      Since:
      1