Class MergeContext

    • Method Detail

      • clear

        public void clear()
        Clears the MergeContext.
        Specified by:
        clear in interface Map<Object,​Object>
      • containsKey

        public boolean containsKey​(Object mergeEntity)
        Returns true if this MergeContext contains a cross-reference for the specified merge entity to a managed entity result.
        Specified by:
        containsKey in interface Map<Object,​Object>
        Parameters:
        mergeEntity - must be non-null
        Returns:
        true if this MergeContext contains a cross-reference for the specified merge entity
        Throws:
        NullPointerException - if mergeEntity is null
      • containsValue

        public boolean containsValue​(Object managedEntity)
        Returns true if this MergeContext contains a cross-reference from the specified managed entity to a merge entity.
        Specified by:
        containsValue in interface Map<Object,​Object>
        Parameters:
        managedEntity - must be non-null
        Returns:
        true if this MergeContext contains a cross-reference from the specified managed entity to a merge entity
        Throws:
        NullPointerException - if managedEntity is null
      • get

        public Object get​(Object mergeEntity)
        Returns the managed entity associated with the specified merge Entity.
        Specified by:
        get in interface Map<Object,​Object>
        Parameters:
        mergeEntity - the merge entity; must be non-null
        Returns:
        the managed entity associated with the specified merge Entity
        Throws:
        NullPointerException - if mergeEntity is null
      • isEmpty

        public boolean isEmpty()
        Returns true if this MergeContext contains no merge-to-managed entity cross-references.
        Specified by:
        isEmpty in interface Map<Object,​Object>
        Returns:
        true if this MergeContext contains no merge-to-managed entity cross-references.
      • keySet

        public Set<Object> keySet()
        Returns an unmodifiable set view of the merge entities contained in this MergeContext
        Specified by:
        keySet in interface Map<Object,​Object>
        Returns:
        an unmodifiable set view of the merge entities contained in this MergeContext
        See Also:
        Collections.unmodifiableSet(Set)
      • put

        public Object put​(Object mergeEntity,
                          Object managedEntity)
        Associates the specified merge entity with the specified managed entity result in this MergeContext. If this MergeContext already contains a cross-reference for mergeEntity when this method is called, then managedEntity must be the same as what is already associated with mergeEntity.

        This method assumes that the merge process is not yet operating on mergeEntity. Later when mergeEntity enters the merge process, setOperatedOn(Object, boolean) should be called.

        Specified by:
        put in interface Map<Object,​Object>
        Parameters:
        mergeEntity - the merge entity; must be non-null
        managedEntity - the managed entity result; must be non-null
        Returns:
        previous managed entity associated with specified merge entity, or null if there was no mapping for mergeEntity.
        Throws:
        NullPointerException - if mergeEntity or managedEntity is null
        IllegalArgumentException - if managedEntity is not the same as the previous managed entity associated with merge entity
        IllegalStateException - if internal cross-references are out of sync,
      • put

        public Object put​(Object mergeEntity,
                          Object managedEntity,
                          boolean isOperatedOn)
        Associates the specified merge entity with the specified managed entity in this MergeContext. If this MergeContext already contains a cross-reference for mergeEntity when this method is called, then managedEntity must be the same as what is already associated with mergeEntity.
        Parameters:
        mergeEntity - the merge entity; must be non-null
        managedEntity - the managed entity; must be non-null
        isOperatedOn - indicates if the merge operation is performed on the mergeEntity.
        Returns:
        previous managed entity associated with specified merge entity, or null if there was no mapping for mergeEntity.
        Throws:
        NullPointerException - if mergeEntity or managedEntity is null
        IllegalArgumentException - if managedEntity is not the same as the previous managed entity associated with mergeEntity
        IllegalStateException - if internal cross-references are out of sync,
      • putAll

        public void putAll​(Map<?,​?> map)
        Copies all of the mappings from the specified Map to this MergeContext. The key and value for each entry in map is subject to the same restrictions as put(Object mergeEntity, Object managedEntity). This method assumes that the merge process is not yet operating on any merge entity
        Specified by:
        putAll in interface Map<Object,​Object>
        Parameters:
        map - keys and values must be non-null
        Throws:
        NullPointerException - if any key or value is null
        IllegalArgumentException - if a key in map was already in this MergeContext but associated value in map is different from the previous value in this MergeContext.
        IllegalStateException - if internal cross-references are out of sync,
      • size

        public int size()
        Returns the number of merge-to-managed entity cross-references in this MergeContext
        Specified by:
        size in interface Map<Object,​Object>
        Returns:
        the number of merge-to-managed entity cross-references in this MergeContext
      • isOperatedOn

        public boolean isOperatedOn​(Object mergeEntity)
        Returns true if the listener is performing the merge operation on the specified merge entity.
        Parameters:
        mergeEntity - the merge entity; must be non-null
        Returns:
        true if the listener is performing the merge operation on the specified merge entity; false, if there is no mapping for mergeEntity.
        Throws:
        NullPointerException - if mergeEntity is null
      • setOperatedOn

        public void setOperatedOn​(Object mergeEntity,
                                  boolean isOperatedOn)
        Set flag to indicate if the listener is performing the merge operation on the specified merge entity.
        Parameters:
        mergeEntity - must be non-null and this MergeContext must contain a cross-reference for mergeEntity to a managed entity
        Throws:
        NullPointerException - if mergeEntity is null
        IllegalStateException - if this MergeContext does not contain a a cross-reference for mergeEntity
      • invertMap

        public Map<Object,​Object> invertMap()
        Returns an unmodifiable map view of the managed-to-merge entity cross-references. The returned Map will contain a cross-reference from each managed entity to the most recently associated merge entity that was most recently put in the MergeContext.
        Returns:
        an unmodifiable map view of the managed-to-merge entity cross-references.
        See Also:
        Collections.unmodifiableMap(Map)