Class FailingValidator

  • All Implemented Interfaces:
    Editor, Validator

    public class FailingValidator
    extends java.lang.Object
    implements Validator
    Validator that rejects all changes. Useful as a sentinel or as a tool for testing composite validators.
    Since:
    Oak 0.3
    • Constructor Detail

      • FailingValidator

        public FailingValidator()
      • FailingValidator

        public FailingValidator​(java.lang.String type,
                                int code,
                                java.lang.String message)
    • Method Detail

      • enter

        public void enter​(NodeState before,
                          NodeState after)
        Description copied from interface: Editor
        Called before the given before and after states are compared. The implementation can use this method to initialize any internal state needed for processing the results of the comparison. For example an implementation could look up the effective node type of the after state to know what constraints to apply to on the content changes.
        Specified by:
        enter in interface Editor
        Parameters:
        before - before state, non-existent if this node was added
        after - after state, non-existent if this node was removed
      • leave

        public void leave​(NodeState before,
                          NodeState after)
        Description copied from interface: Editor
        Called after the given before and after states are compared. The implementation can use this method to post-process information collected during the content diff. For example an implementation that during the diff just recorded the fact that this node was modified in some way could then use this method to trigger an index update based on that modification flag.
        Specified by:
        leave in interface Editor
        Parameters:
        before - before state, non-existent if this node was added
        after - after state, non-existent if this node was removed
      • childNodeChanged

        public Validator childNodeChanged​(java.lang.String name,
                                          NodeState before,
                                          NodeState after)
        Description copied from interface: Validator
        Validate a changed node
        Specified by:
        childNodeChanged in interface Editor
        Specified by:
        childNodeChanged in interface Validator
        Parameters:
        name - the name of the changed node
        before - the original node
        after - the changed node
        Returns:
        a Validator for after or null if validation should not decent into the subtree rooted at after.