Class ManagedIdEntitiesImpl<E extends ManagedId>

    • Field Detail

      • managedIdClass

        protected final Class<? extends ManagedId> managedIdClass
        the class signature used for generating the managed id within the group defined by the token
    • Constructor Detail

      • ManagedIdEntitiesImpl

        protected ManagedIdEntitiesImpl​(Function<E,​Long> valueToKey,
                                        Class<? extends ManagedId> managedIdClass)
        Constructor
        Parameters:
        valueToKey - the mapping from key to value of the graph entity
        managedIdClass - should reflect the class signature used for generating the managed id of this class when creating it via the factory of this container
      • ManagedIdEntitiesImpl

        protected ManagedIdEntitiesImpl​(Function<E,​Long> valueToKey)
        Constructor. while not recommended it is allowed to create managed ids that do not rely on id generation of the class itself. It can be that they rely on child ids or synced ids of other internal referenced classes. In that case this constructor can be used directly. this however should generally be avoided.
        Parameters:
        valueToKey - the mapping from key to value of the graph entity
      • ManagedIdEntitiesImpl

        protected ManagedIdEntitiesImpl​(ManagedIdEntitiesImpl<E> other,
                                        boolean deepCopy,
                                        BiConsumer<E,​E> mapper)
        copy constructor
        Parameters:
        other - to copy
        deepCopy - when true, create a deep copy, shallow copy otherwise
        mapper - to apply in case of deep copy to each original to copy combination (when provided, may be null)
    • Method Detail

      • updateIdMapping

        protected void updateIdMapping()
        updates the container keys based on currently presiding ids. Only to be used when an external force has changed already registered entity their ids
      • getManagedIdClass

        public 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
        Specified by:
        getManagedIdClass in interface ManagedIdEntities<E extends ManagedId>
        Returns:
        managedIdClass for instances this factory creates
      • recreateIds

        public 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
        Specified by:
        recreateIds in interface ManagedIdEntities<E extends ManagedId>
        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
      • reset

        public 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
        Specified by:
        reset in interface ManagedIdEntities<E extends ManagedId>