Skip to content

What are attributes?

Elliot Ford edited this page Jun 28, 2015 · 12 revisions

Overview

Attributes are typed key-value pairs such as username:String = Ellzord that are stored within containers.

What is an AttributeType?

An AttributeType defines the value Type for an attribute value. Because it is backed by Type it can differentiate between Collection<String> and Collection<Integer> (see Creating an AttributeType for more information). Rather than pairing the AttributeType with the key name over and over NamedAttributeType can be used. The attribute utilities cover a bunch of useful type methods (see Useful utility methods).

What is an AttributeContainer?

An AttributeContainer is an interface that provides all the method definitions for adding, removing and retrieving attribute values. There is a default implementation provided, DefaultAttributeContainer, which is thread-safe and fully featured. DefaultAttributeContainer.Builder (see API docs) can be used to easily build a container instance.

What is an AttributeListener?

When attribute values are added, changed internally (manually fired) or removed an AttributeEvent is created and handed out to all AttributeListeners matching the name and type.

Useful utility methods

For some handy attribute related methods see Attributes (API docs for Attributes):

Clone this wiki locally