org.qi4j.api.association

## Interface NamedAssociation<T>

- Type Parameters:
    `T` - Parameterized associatee type
  All Superinterfaces:
    AbstractAssociation, Iterable<String>
  All Known Implementing Classes:
    NamedAssociationWrapper

      public interface NamedAssociation<T>
      extends Iterable<String>, AbstractAssociation

  Association to named Entities. The Iterable<String> returns the names in the association set.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `containsName(String name)` Checks if there is an association with the given name.
    `int` | `count()`
    `T` | `get(String name)` Retrieves a named association.
    `String` | `nameOf(T entity)` Checks if the entity is present.
    `boolean` | `put(String name, T entity)` Adds a named assocation.
    `EntityReference` | `referenceOf(String name)` Returns the EntityReference for the Association with the given name.
    `Iterable<EntityReference>` | `references()` Returns an unmodifiable Iterable of the references to the associated entities.
    `boolean` | `remove(String name)` Remove a named association.
    `Map<String,T>` | `toMap()`

    - ### Methods inherited from interface java.lang.Iterable

      `iterator`

- - ### Method Detail

    - #### count

          int count()

      Returns:
        The number of named associations in this NamedAssociation.

    - #### containsName

          boolean containsName(String name)

      Checks if there is an association with the given name.
      Parameters:
        `name` - The name of the association we are checking if it exists.
      Returns:
        true if it exists, false otherwise

    - #### put

          boolean put(String name,
                    T entity)

      Adds a named assocation.
      Parameters:
        `name` - The name of the association.
        `entity` - The entity for this named association.
      Returns:
        true if putted, false otherwise

    - #### remove

          boolean remove(String name)

      Remove a named association.
      Parameters:
        `name` - The name of the association.
      Returns:
        true if removed, false otherwise

    - #### get

          T get(String name)

      Retrieves a named association.
      Parameters:
        `name` - The name of the association.
      Returns:
        The entity that has previously been associated.

    - #### nameOf

          String nameOf(T entity)

      Checks if the entity is present. Note that this is potentially a very slow operation, depending on the size of the NamedAssociation.
      Parameters:
        `entity` - The entity to look for.
      Returns:
        The name of the entity if found, otherwise null.

    - #### toMap

          Map<String,T> toMap()

      Returns:
        A fully populated Map with the content of this NamedAssociation.

    - #### references

          Iterable<EntityReference> references()

      Returns an unmodifiable Iterable of the references to the associated entities.
      Returns:
        the references to the associated entities.

    - #### referenceOf

          EntityReference referenceOf(String name)

      Returns the EntityReference for the Association with the given name.
      Parameters:
        `name` - The name of the association to return the EntityReference for
      Returns:
        The EntityReference of the association.