Class ChangeSet


  • public final class ChangeSet
    extends Object
    A ChangeSet is a collection of items that have been changed as part of a commit. A ChangeSet is immutable and built by a ChangeSetBuilder.

    Those items are parent paths, parent node names, parent node types and (child) properties. 'Changed' refers to any of add, remove, change (where applicable).

    A ChangeSet is piggybacked on a CommitInfo in the CommitContext and can be used by (downstream) Observers for their convenience.

    To limit memory usage, the ChangeSet has a limit on the number of items, each, that it collects. If one of those items reach the limit this is called an 'overflow' and the corresponding item type is marked as having 'overflown'. Downstream Observers should thus check if a particular item has overflown or not - this is indicated with null as the return value of the corresponding getters (while empty means: not overflown but nothing changed of that type).

    Also, the ChangeSet carries a 'maxPathDepth' which is the depth of the path up until which paths have been collected. Thus any path that is longer than this 'maxPathDepth' will be cut off and only reported up to that max depth. Downstream Observers should thus inspect the 'maxPathDepth' and compare actual path depths with it in order to find out if any child paths have been cut off.

    Naming: note that path, node name and node types all refer to the *parent* of a change. While properties naturally are leafs.

    • Field Detail

      • COMMIT_CONTEXT_OBSERVATION_CHANGESET

        public static final String COMMIT_CONTEXT_OBSERVATION_CHANGESET
        See Also:
        Constant Field Values
    • Method Detail

      • doesHitMaxPathDepth

        public boolean doesHitMaxPathDepth()
      • getParentPaths

        @Nullable
        public @Nullable Set<String> getParentPaths()
      • getParentNodeNames

        @Nullable
        public @Nullable Set<String> getParentNodeNames()
      • getParentNodeTypes

        @Nullable
        public @Nullable Set<String> getParentNodeTypes()
      • getPropertyNames

        @Nullable
        public @Nullable Set<String> getPropertyNames()
      • getMaxPrefilterPathDepth

        public int getMaxPrefilterPathDepth()
      • getAllNodeTypes

        @Nullable
        public @Nullable Set<String> getAllNodeTypes()
      • anyOverflow

        public boolean anyOverflow()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • asString

        public String asString()