Class ChangeSet


  • public final class ChangeSet
    extends java.lang.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 java.lang.String COMMIT_CONTEXT_OBSERVATION_CHANGESET
        See Also:
        Constant Field Values
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • doesHitMaxPathDepth

        public boolean doesHitMaxPathDepth()
      • getParentPaths

        @Nullable
        public @Nullable java.util.Set<java.lang.String> getParentPaths()
      • getParentNodeNames

        @Nullable
        public @Nullable java.util.Set<java.lang.String> getParentNodeNames()
      • getParentNodeTypes

        @Nullable
        public @Nullable java.util.Set<java.lang.String> getParentNodeTypes()
      • getPropertyNames

        @Nullable
        public @Nullable java.util.Set<java.lang.String> getPropertyNames()
      • getMaxPrefilterPathDepth

        public int getMaxPrefilterPathDepth()
      • getAllNodeTypes

        @Nullable
        public @Nullable java.util.Set<java.lang.String> getAllNodeTypes()
      • anyOverflow

        public boolean anyOverflow()
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

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

        public java.lang.String asString()
      • fromString

        public static ChangeSet fromString​(java.lang.String json)