Package org.apache.qpid.proton.engine

# Class ExtendableAccessor<E extends Extendable,T>

java.lang.Object
org.apache.qpid.proton.engine.ExtendableAccessor<E,T>

Type Parameters:
  `E` - An `Extendable` type where the data is to be stored
  `T` - The type of the data to be stored

public final class ExtendableAccessor<E extends Extendable,T> extends Object
A typesafe convenience class for associating additional data with `Extendable` classes.

An instance of `ExtendableAccessor` uses itself as the key in the `Extendable.attachments()` so it's best instantiated as a static final member.

       class Foo extends BaseHandler {
         private static ExtendableAccessor<Link, Bar> LINK_BAR = new ExtendableAccessor<>(Bar.class);
         void onLinkRemoteOpen(Event e) {
           Bar bar = LINK_BAR.get(e.getLink());
           if (bar == null) {
             bar = new Bar();
             LINK_BAR.set(e.getLink(), bar);
             }
           }
         }

## Constructor Summary

Constructors
Constructor
Description
`ExtendableAccessor(Class<T> klass)`

## Method Summary

Modifier and Type
Method
Description
`T`
`get(E e)`
`void`
`set(E e, T value)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### ExtendableAccessor

public ExtendableAccessor(Class<T> klass)

## Method Details

### get

public T get(E e)

### set

public void set(E e, T value)