Interface ManagedIdEntities<E extends ManagedId>

    • Method Detail

      • getFactory

        ManagedIdEntityFactory<E> getFactory()
        Factory to create instance of managed id entity (for this container class)
        Returns:
        entity factory
      • getManagedIdClass

        Class<? extends ManagedId> getManagedIdClass()
        Collect the class identifier used for the managed ids within the id group for instances of this class used in this container
        Returns:
        managedIdClass for instances this factory creates
      • recreateIds

        void recreateIds​(boolean resetManagedIdClass)
        Recreate the ids for all registered entities with or without resetting, this includes child managed ids, i.e., nested magedidentities containers if so indicated
        Parameters:
        resetManagedIdClass - when true we reset the managedId's counter to zero (via its id class) before recreating the ids, otherwise we simply recreate the managed id by starting with the next available id without resetting
      • deepClone

        ManagedIdEntities<E> deepClone()
        Deep clone implementation
        Returns:
        deep copy of entities
      • deepCloneWithMapping

        ManagedIdEntities<E> deepCloneWithMapping​(BiConsumer<E,​E> mapper)
        Deep clone implementation where the mapping for its internal copies is captured by the provided mapper
        Parameters:
        mapper - to apply to each mapping between original and copy
        Returns:
        copy
      • containsKey

        default boolean containsKey​(long id)
        Verify if present
        Specified by:
        containsKey in interface LongMapWrapper<E extends ManagedId>
        Parameters:
        id - to verify
        Returns:
        true when present false otherwise
      • reset

        default void reset()
        When reset it called, it not only clears the entries, but also resets the managedids, such that when the container is reused the managed ids start from zero again. If any entries are managedEntities themselves or contain managed entities themselves, they are reset as well
      • groupBy

        default <K> Map<K,​List<E>> groupBy​(Function<? super E,​? extends K> classifier)
        Convenience method to perform group by based on uncerlying streaming mechanisms
        Type Parameters:
        K - classifier to apply
        Parameters:
        classifier - for group by
        Returns:
        map with key containing the classifier and value being a list of matched entities in the container
      • streamSortedBy

        default <T extends Comparable,​F extends EStream<F> streamSortedBy​(Function<? super E,​T> sortFunction)
        Stream the container sorted by the given sort function
        Type Parameters:
        T - the type to sort on which must be comparable
        F - the return type of the stream entries
        Parameters:
        sortFunction - to apply
        Returns:
        sorted stream