org.qi4j.api.association

## Class NamedAssociationWrapper

- java.lang.Object
- - org.qi4j.api.association.NamedAssociationWrapper

- All Implemented Interfaces:
    Iterable<String>, AbstractAssociation, NamedAssociation<Object>

      public class NamedAssociationWrapper
      extends Object
      implements NamedAssociation<Object>

  If you want to catch calls to NamedAssociations, then create a GenericConcern that wraps the Zest-supplied NamedAssociations instance with NamedAssociationsWrapper. Override methods to perform your custom code.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected NamedAssociation<Object>` | `next`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `NamedAssociationWrapper(NamedAssociation<Object> next)`

  - ### 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()`
    `boolean` | `equals(Object obj)`
    `Object` | `get(String name)` Retrieves a named association.
    `int` | `hashCode()`
    `Iterator<String>` | `iterator()`
    `String` | `nameOf(Object entity)` Checks if the entity is present.
    `NamedAssociation<Object>` | `next()`
    `boolean` | `put(String name, Object 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,Object>` | `toMap()`
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### next

          protected NamedAssociation<Object> next

  - ### Constructor Detail

    - #### NamedAssociationWrapper

          public NamedAssociationWrapper(NamedAssociation<Object> next)

  - ### Method Detail

    - #### next

          public NamedAssociation<Object> next()

    - #### iterator

          public Iterator<String> iterator()

      Specified by:
        `iterator` in interface `Iterable<String>`

    - #### count

          public int count()

      Specified by:
        `count` in interface `NamedAssociation<Object>`
      Returns:
        The number of named associations in this NamedAssociation.

    - #### containsName

          public boolean containsName(String name)

      Description copied from interface: `NamedAssociation`
      Checks if there is an association with the given name.
      Specified by:
        `containsName` in interface `NamedAssociation<Object>`
      Parameters:
        `name` - The name of the association we are checking if it exists.
      Returns:
        true if it exists, false otherwise

    - #### put

          public boolean put(String name,
                    Object entity)

      Description copied from interface: `NamedAssociation`
      Adds a named assocation.
      Specified by:
        `put` in interface `NamedAssociation<Object>`
      Parameters:
        `name` - The name of the association.
        `entity` - The entity for this named association.
      Returns:
        true if putted, false otherwise

    - #### remove

          public boolean remove(String name)

      Description copied from interface: `NamedAssociation`
      Remove a named association.
      Specified by:
        `remove` in interface `NamedAssociation<Object>`
      Parameters:
        `name` - The name of the association.
      Returns:
        true if removed, false otherwise

    - #### get

          public Object get(String name)

      Description copied from interface: `NamedAssociation`
      Retrieves a named association.
      Specified by:
        `get` in interface `NamedAssociation<Object>`
      Parameters:
        `name` - The name of the association.
      Returns:
        The entity that has previously been associated.

    - #### nameOf

          public String nameOf(Object entity)

      Description copied from interface: `NamedAssociation`
      Checks if the entity is present. Note that this is potentially a very slow operation, depending on the size of the NamedAssociation.
      Specified by:
        `nameOf` in interface `NamedAssociation<Object>`
      Parameters:
        `entity` - The entity to look for.
      Returns:
        The name of the entity if found, otherwise null.

    - #### toMap

          public Map<String,Object> toMap()

      Specified by:
        `toMap` in interface `NamedAssociation<Object>`
      Returns:
        A fully populated Map with the content of this NamedAssociation.

    - #### references

          public Iterable<EntityReference> references()

      Description copied from interface: `NamedAssociation`
      Returns an unmodifiable Iterable of the references to the associated entities.
      Specified by:
        `references` in interface `NamedAssociation<Object>`
      Returns:
        the references to the associated entities.

    - #### referenceOf

          public EntityReference referenceOf(String name)

      Description copied from interface: `NamedAssociation`
      Returns the EntityReference for the Association with the given name.
      Specified by:
        `referenceOf` in interface `NamedAssociation<Object>`
      Parameters:
        `name` - The name of the association to return the EntityReference for
      Returns:
        The EntityReference of the association.

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`