WeightedAshwoodEntitySorter (cayenne-doc: Cayenne Documentation 5.0-M2 API)
Description: declaration: package: org.apache.cayenne.ashwood, class: WeightedAshwoodEntitySorter

# Class WeightedAshwoodEntitySorter

java.lang.Object
org.apache.cayenne.ashwood.AshwoodEntitySorter
org.apache.cayenne.ashwood.WeightedAshwoodEntitySorter

All Implemented Interfaces:
  `EntitySorter`

public class WeightedAshwoodEntitySorter extends AshwoodEntitySorter
EntitySorter that takes into account entity "weights", and otherwise delegating to another (topological) sorter.

Since:
  3.1, since 4.0 moved to cayenne-server from cayenne-lifecycle

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected Map<DbEntity,Integer>`
  `entityWeights`

  ### Fields inherited from class AshwoodEntitySorter

  `components, dbEntityComparator, entityResolver, objEntityComparator, reflexiveDbEntities`
  Modifier and Type
  Field
  Description
  `protected Map<DbEntity, org.apache.cayenne.ashwood.AshwoodEntitySorter.ComponentRecord>`
  `components`
  `protected Comparator<DbEntity>`
  `dbEntityComparator`
  `protected EntityResolver`
  `entityResolver`
  `protected Comparator<ObjEntity>`
  `objEntityComparator`
  `protected Map<DbEntity, List<DbRelationship>>`
  `reflexiveDbEntities`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `WeightedAshwoodEntitySorter()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `addWeightForEntity(ObjEntity entity)`
  `protected void`
  `doIndexSorter()`
  Reindexes internal sorter without synchronization.
  `protected Comparator<DbEntity>`
  `getDbEntityComparator(boolean dependantFirst)`
  `protected Comparator<ObjEntity>`
  `getObjEntityComparator(boolean dependantFirst)`

  ### Methods inherited from class AshwoodEntitySorter

  `buildDigraph, findReflexiveMaster, getDbEntityComparator, getObjEntityComparator, getReflexiveRelationshipsNames, indexSorter, isReflexive, setEntityResolver, sortDbEntities, sortObjectsForEntity, sortObjectsForEntity, sortObjEntities, topologicalSort`
  Modifier and Type
  Method
  Description
  `protected <E> Digraph<E,Boolean>`
  `buildDigraph(ObjEntity objEntity, List<E> objects, Function<E, Persistent> converter)`
  `protected Persistent`
  `findReflexiveMaster(Persistent object, ObjRelationship toOneRel, String targetEntityName)`
  `Comparator<DbEntity>`
  `getDbEntityComparator()`
  `Comparator<ObjEntity>`
  `getObjEntityComparator()`
  `protected String[]`
  `getReflexiveRelationshipsNames(ObjEntity objEntity)`
  `protected void`
  `indexSorter()`
  Reindexes internal sorter in a thread-safe manner.
  `boolean`
  `isReflexive(DbEntity metadata)`
  `void`
  `setEntityResolver(EntityResolver entityResolver)`
  Sets EntityResolver for this sorter.
  `void`
  `sortDbEntities(List<DbEntity> dbEntities, boolean deleteOrder)`
  Sorts a list of DbEntities.
  `void`
  `sortObjectsForEntity(ObjEntity objEntity, List<?> objects, boolean deleteOrder)`
  Sorts a list of objects belonging to the ObjEntity.
  `protected <E> void`
  `sortObjectsForEntity(ObjEntity objEntity, List<E> objects, boolean deleteOrder, Function<E, Persistent> converter)`
  `void`
  `sortObjEntities(List<ObjEntity> objEntities, boolean deleteOrder)`
  Sorts a list of ObjEntities.
  `protected <E> boolean`
  `topologicalSort(List<E> data, Digraph<E,Boolean> graph, boolean reverse)`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### entityWeights

    protected Map<DbEntity,Integer> entityWeights

- ## Constructor Details

  - ### WeightedAshwoodEntitySorter

    public WeightedAshwoodEntitySorter()

- ## Method Details

  - ### doIndexSorter

    protected void doIndexSorter()
    Description copied from class: `AshwoodEntitySorter`
    Reindexes internal sorter without synchronization.
    Overrides:
      `doIndexSorter` in class `AshwoodEntitySorter`

  - ### addWeightForEntity

    protected void addWeightForEntity(ObjEntity entity)

  - ### getDbEntityComparator

    protected Comparator<DbEntity> getDbEntityComparator(boolean dependantFirst)
    Overrides:
      `getDbEntityComparator` in class `AshwoodEntitySorter`

  - ### getObjEntityComparator

    protected Comparator<ObjEntity> getObjEntityComparator(boolean dependantFirst)
    Overrides:
      `getObjEntityComparator` in class `AshwoodEntitySorter`