public class

ValidationPattern

extends Object
java.lang.Object
   ↳ com.atlassian.plugin.util.validation.ValidationPattern

Class Overview

Validates a pattern of rules against a dom4j node, patterned off of Schematron

Summary

Nested Classes
class ValidationPattern.Rule The rule as a series of tests  
class ValidationPattern.RuleTest A test within a rule  
Public Methods
static ValidationPattern createPattern()
void evaluate(Node node)
Evaluates the rules against the provided node
ValidationPattern rule(String context, RuleTest... tests)
Adds a rule to the current pattern
ValidationPattern rule(RuleTest... tests)
Adds a rule to the current pattern, assuming the current context is "."
static ValidationPattern.RuleTest test(String xpath)
Creates a test using the passed xpath expression
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static ValidationPattern createPattern ()

Returns
  • a new pattern instance

public void evaluate (Node node)

Evaluates the rules against the provided node

Parameters
node The node to evaluate
Throws
ValidationException If a validation error occurs. If wanting to resolve i18n keys to messages, you can access the list of errors from the exception.

public ValidationPattern rule (String context, RuleTest... tests)

Adds a rule to the current pattern

Parameters
context The xpath expression to determine one or more nodes to evaluate the rules against
tests A series of tests
Returns
  • this for chaining

public ValidationPattern rule (RuleTest... tests)

Adds a rule to the current pattern, assuming the current context is "."

Parameters
tests A series of tests
Returns
  • this for chaining

public static ValidationPattern.RuleTest test (String xpath)

Creates a test using the passed xpath expression

Parameters
xpath The test expression
Returns
  • The rule to mutate