V
- The type of BaseValue
@CatalogedBy(value=Keys.class) public interface Key<V extends BaseValue<?>> extends CatalogType
BaseValue
such that the underlying
value can be retrieved from a ValueContainer
. As well, a Key
can be used for DataSerializable
s with the included
getQuery()
to retrieve the recommended DataQuery
to use.Modifier and Type | Interface and Description |
---|---|
static interface |
Key.Builder<E,V extends BaseValue<E>> |
Modifier and Type | Method and Description |
---|---|
static Key.Builder<?,?> |
builder()
Creates a
Key.Builder which allows creation of a Key
to later be registered for accessing values from
a ValueContainer . |
TypeToken<?> |
getElementToken()
|
DataQuery |
getQuery()
Gets the
DataQuery for recommended use with
DataContainer s. |
TypeToken<V> |
getValueToken()
|
<E extends DataHolder> |
registerEvent(Class<E> holderFilter,
EventListener<ChangeDataHolderEvent.ValueChange> listener)
Register an event listener which listens to the value the key accesses
changing.
|
getId, getName
static Key.Builder<?,?> builder()
Key.Builder
which allows creation of a Key
to later be registered for accessing values from
a ValueContainer
.TypeToken<?> getElementToken()
BaseValue
this Key
is representing. On occasion, if the element is a Collection
type,
one can occasionally use TypeToken.resolveType(Type)
with
Class.getTypeParameters()
as the type parameter of a collection
is retrievable, such as the element type parameter for List
or
Map
.DataQuery getQuery()
DataQuery
for recommended use with
DataContainer
s.DataQuery
for use<E extends DataHolder> void registerEvent(Class<E> holderFilter, EventListener<ChangeDataHolderEvent.ValueChange> listener)
E
- The class type of the data holderholderFilter
- The data holder to filter withlistener
- The event listener