# Interface EntitySorter

All Known Implementing Classes:
  `AshwoodEntitySorter, WeightedAshwoodEntitySorter`

public interface EntitySorter
Defines API for sorting of Cayenne entities based on their mutual dependencies.

Since:
  1.1

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Comparator<DbEntity>`
  `getDbEntityComparator()`
  `Comparator<ObjEntity>`
  `getObjEntityComparator()`
  `boolean`
  `isReflexive(DbEntity entity)`
  `void`
  `reindex()`
  Rebuilds the internal index off the current state of the sorter's EntityResolver.
  `void`
  `sortDbEntities(List<DbEntity> dbEntities, boolean deleteOrder)`
  Sorts a list of DbEntities.
  `void`
  `sortObjectsForEntity(ObjEntity entity, List<?> objects, boolean deleteOrder)`
  Sorts a list of objects belonging to the ObjEntity.
  `void`
  `sortObjEntities(List<ObjEntity> objEntities, boolean deleteOrder)`
  Sorts a list of ObjEntities.

- ## Method Details

  - ### reindex

    void reindex()
    Rebuilds the internal index off the current state of the sorter's EntityResolver. Called when the set of entities changes.
    Since:
      5.0

  - ### sortDbEntities

    void sortDbEntities(List<DbEntity> dbEntities, boolean deleteOrder)
    Sorts a list of DbEntities.

  - ### sortObjEntities

    void sortObjEntities(List<ObjEntity> objEntities, boolean deleteOrder)
    Sorts a list of ObjEntities.

  - ### sortObjectsForEntity

    void sortObjectsForEntity(ObjEntity entity, List<?> objects, boolean deleteOrder)
    Sorts a list of objects belonging to the ObjEntity.

  - ### getDbEntityComparator

    Comparator<DbEntity> getDbEntityComparator()
    Returns:
      comparator for `DbEntity`
    Since:
      4.2

  - ### getObjEntityComparator

    Comparator<ObjEntity> getObjEntityComparator()
    Returns:
      comparator for `ObjEntity`
    Since:
      4.2

  - ### isReflexive

    boolean isReflexive(DbEntity entity)
    Parameters:
      `entity` - to check
    Returns:
      is entity has reflexive relationships
    Since:
      4.2