Interface EntityReplacementStrategy

  • All Known Implementing Classes:
    EntityReplacementStrategyImpl

    public interface EntityReplacementStrategy
    Generic interface to support swapping out one entity with another. Use primarily in GTFS loading to consolidate stops from GTFS feeds from separate agencies that have stops in common.
    Author:
    bdferris
    See Also:
    EntityReplacementStrategyFactory
    • Method Detail

      • setEntityReplacementLogger

        void setEntityReplacementLogger​(EntityReplacementLogger logger)
        optionally inject a logger for recording replacements
        Parameters:
        logger -
      • hasReplacementEntities

        boolean hasReplacementEntities​(Class<?> entityType)
        Parameters:
        entityType -
        Returns:
        true if there are any entity replacements for classes of the specified type
      • hasReplacementEntity

        boolean hasReplacementEntity​(Class<?> entityType,
                                     Serializable id)
        Parameters:
        entityType -
        id -
        Returns:
        true if there is an entity replacement for a entity with the specified type and id
      • getReplacementEntityId

        Serializable getReplacementEntityId​(Class<?> entityType,
                                            Serializable id)
        Parameters:
        entityType -
        id -
        Returns:
        the replacement entity id for the target entity of specified type and id, or null if no replacement is needed
      • logReplacement

        <T> T logReplacement​(Class<T> type,
                             Serializable id,
                             Serializable replacementId,
                             T originalEntity,
                             T replacementEntity)
        Log that replacement has occurred.
        Parameters:
        id -
        originalEntity -
        replacementEntity -