Class XmlOperation

java.lang.Object
io.jenkins.plugins.xmleditor.core.edit.XmlOperation
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
AddElement, Remove, RemoveAttribute, SetAttribute, SetText, Upsert

public abstract class XmlOperation extends Object implements Serializable
One modification applied to every node selected by xpath().
See Also:
  • Constructor Details

    • XmlOperation

      protected XmlOperation(String xpath, String expected)
  • Method Details

    • type

      public abstract String type()
      Name used in reports and messages, e.g. setText.
    • xpath

      public String xpath()
    • expected

      public String expected()
    • applyTo

      protected abstract boolean applyTo(LItem target, EditContext context) throws XmlEditorException
      Applies the operation to one selected node.
      Returns:
      true when the document actually changed
      Throws:
      XmlEditorException
    • defaultExpected

      protected String defaultExpected()
      Expectation used when the user did not set expected; null means AT_LEAST_ONE.
    • applyWhenNoMatch

      protected boolean applyWhenNoMatch(EditContext context, XPathEngine engine) throws XmlEditorException
      Called when the XPath matched nothing (and the expectation allowed it).
      Returns:
      true when the document changed
      Throws:
      XmlEditorException
    • unsupported

      protected XmlEditorException unsupported(LItem target)