ExtendableAccessor

A typesafe convenience class for associating additional data with {@link Extendable} classes. <p> An instance of <code>ExtendableAccessor</code> uses itself as the key in the {@link Extendable#attachments()} so it's best instantiated as a static member. <pre><code> class Foo extends BaseHandler { private static ExtendableAccessor&lt;Link, Bar&gt; LINK_BAR = new ExtendableAccessor&lt;&gt;(Bar.class); void onLinkRemoteOpen(Event e) { Bar bar = LINK_BAR.get(e.getLink()); if (bar is null) { bar = new Bar(); LINK_BAR.set(e.getLink(), bar); } } } </code></pre>

@param <E> An {@link Extendable} type where the data is to be stored @param <T> The type of the data to be stored

Constructors

this
this()
Undocumented in source.

Members

Functions

attachments
Record attachments()
Undocumented in source. Be warned that the author may not have intended to support it.
get
T get(E e, string key)
Undocumented in source. Be warned that the author may not have intended to support it.
set
void set(E e, T value, string key)
Undocumented in source. Be warned that the author may not have intended to support it.

Inherited Members

From Extendable

attachments
Record attachments()
Undocumented in source.

Meta