Package org.apache.cayenne.access

## Class ToManyList<E>

- java.lang.Object
- - org.apache.cayenne.util.RelationshipFault<E>
  - - org.apache.cayenne.util.PersistentObjectList<E>
    - - org.apache.cayenne.access.ToManyList<E>

- All Implemented Interfaces:
    `Serializable`, `Iterable<E>`, `Collection<E>`, `List<E>`, `PersistentObjectCollection<E>`, `ValueHolder<List<E>>`

      public class ToManyList<E>
      extends PersistentObjectList<E>
      implements Serializable

  A list that holds objects for to-many relationships. All operations, except for resolving the list from DB, are not synchronized. The safest way to implement custom synchronization is to synchronize on parent ObjectStore.
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class org.apache.cayenne.util.PersistentObjectList

      `addedToUnresolved, objectList, removedFromUnresolved`

    - ### Fields inherited from class org.apache.cayenne.util.RelationshipFault

      `relationshipName, relationshipOwner`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ToManyList​(Persistent source, String relationship)` | Creates ToManyList.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `int` | `hashCode()` |
    `protected void` | `postprocessAdd​(E addedObject)` |
    `protected void` | `postprocessAdd​(Collection<? extends E> collection)` |
    `protected void` | `postprocessRemove​(E removedObject)` |
    `protected void` | `postprocessRemove​(Collection<? extends E> collection)` |
    `protected boolean` | `shouldAddToRemovedFromUnresolvedList​(Object object)` |
    `String` | `toString()` |
    `protected void` | `updateReverse​(List<E> resolved)` |

    - ### Methods inherited from class org.apache.cayenne.util.PersistentObjectList

      `add, add, addAll, addAll, addDirectly, addLocal, clear, clearLocalChanges, contains, containsAll, equals, get, getValue, getValueDirectly, indexOf, invalidate, isEmpty, isFault, iterator, lastIndexOf, listIterator, listIterator, mergeLocalChanges, remove, remove, removeAll, removeDirectly, removeLocal, resolvedObjectList, retainAll, set, setObjectList, setValue, setValueDirectly, size, subList, toArray, toArray`

    - ### Methods inherited from class org.apache.cayenne.util.RelationshipFault

      `getRelationshipName, getRelationshipOwner, isTransientParent, isUncommittedParent, resolveFromDB`

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

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

    - ### Methods inherited from interface java.util.Collection

      `parallelStream, removeIf, stream, toArray`

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

      `forEach`

    - ### Methods inherited from interface java.util.List

      `replaceAll, sort, spliterator`

- - ### Constructor Detail

    - #### ToManyList

          public ToManyList​(Persistent source,
                            String relationship)

      Creates ToManyList.
      Since:
        1.1

  - ### Method Detail

    - #### hashCode

          public int hashCode()

      Specified by:
        `hashCode` in interface `Collection<E>`
      Specified by:
        `hashCode` in interface `List<E>`
      Overrides:
        `hashCode` in class `PersistentObjectList<E>`

    - #### shouldAddToRemovedFromUnresolvedList

          protected boolean shouldAddToRemovedFromUnresolvedList​(Object object)

      Overrides:
        `shouldAddToRemovedFromUnresolvedList` in class `PersistentObjectList<E>`
      Returns:
        whether object should be added to `PersistentObjectList.removedFromUnresolved` during removal

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `PersistentObjectList<E>`

    - #### postprocessAdd

          protected void postprocessAdd​(Collection<? extends E> collection)

      Overrides:
        `postprocessAdd` in class `PersistentObjectList<E>`

    - #### postprocessRemove

          protected void postprocessRemove​(Collection<? extends E> collection)

      Overrides:
        `postprocessRemove` in class `PersistentObjectList<E>`

    - #### postprocessAdd

          protected void postprocessAdd​(E addedObject)

      Overrides:
        `postprocessAdd` in class `PersistentObjectList<E>`

    - #### postprocessRemove

          protected void postprocessRemove​(E removedObject)

      Overrides:
        `postprocessRemove` in class `PersistentObjectList<E>`

    - #### updateReverse

          protected void updateReverse​(List<E> resolved)

      Overrides:
        `updateReverse` in class `RelationshipFault<E>`