A capability can be thought of much like a trait. It allows exposing features in a dynamic and flexible way, without having to resort to directly implementing many interfaces.
In general terms, a capability is a marker object (generally a singleton) which provides an implementation of the capability, specific to the parent object. For instance, in the case of a chest with an inventory, we have:
-
The parent object - this is the Tile Entity, ItemStack, Entity, or whatever it may be that "owns" the capability. In this case, it is the chest Tile Entity.
-
The capability - the "idea" of an inventory can be considered the capability. A capability is not any one implementation of an inventory, but more of a contract stating whether the parent object has the ability (or capability) to be treated as an inventory.