Class AttributeRepository.AttributeKey<T>

  • Type Parameters:
    T - type of value stored in the attribute.
    Enclosing interface:
    AttributeRepository

    public static class AttributeRepository.AttributeKey<T>
    extends java.lang.Object

    Type safe key for storage of user attributes. Typically it is used as a static variable that is shared between the producer and the consumer. To further restrict access the setting or getting it from the store one can add static get/set methods e.g:

     
     public static final AttributeKey<MyValue> MY_KEY = new AttributeKey<MyValue>();
    
     public static MyValue getMyValue(Session s) {
       return s.getAttribute(MY_KEY);
     }
    
     public static void setMyValue(Session s, MyValue value) {
       s.setAttribute(MY_KEY, value);
     }
     
     
    • Constructor Summary

      Constructors 
      Constructor Description
      AttributeKey()  
    • Method Summary

      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AttributeKey

        public AttributeKey()