Class EmptyHook

  • All Implemented Interfaces:
    CommitHook

    public class EmptyHook
    extends java.lang.Object
    implements CommitHook
    Basic commit hook implementation that by default doesn't do anything. This class has a dual purpose:
    1. The static INSTANCE instance can be used as a "null object" in cases where another commit hook has not been configured, thus avoiding the need for extra code for such cases.
    2. Other commit hook implementations can extend this class and gain improved forwards-compatibility to possible changes in the CommitHook interface. For example if it is later decided that new arguments are needed in the hook methods, this class is guaranteed to implement any new method signatures in a way that falls gracefully back to any earlier behavior.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static CommitHook INSTANCE
      Static instance of this class, useful as a "null object".
    • Constructor Summary

      Constructors 
      Constructor Description
      EmptyHook()  
    • Field Detail

      • INSTANCE

        public static final CommitHook INSTANCE
        Static instance of this class, useful as a "null object".
    • Constructor Detail

      • EmptyHook

        public EmptyHook()
    • Method Detail

      • processCommit

        @NotNull
        public @NotNull NodeState processCommit​(NodeState before,
                                                NodeState after,
                                                CommitInfo info)
                                         throws CommitFailedException
        Description copied from interface: CommitHook
        Validates and/or modifies the given content change before it gets persisted.
        Specified by:
        processCommit in interface CommitHook
        Parameters:
        before - content tree before the commit
        after - content tree prepared for the commit
        info - metadata associated with this commit
        Returns:
        content tree to be committed
        Throws:
        CommitFailedException - if the commit should be rejected