Class BuilderSupport

java.lang.Object
ca.uhn.hl7v2.validation.builder.BuilderSupport
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
RuleTypeBuilder

public abstract class BuilderSupport extends Object implements Serializable
Abstract base class for Validation Rule building that provides factory methods for Predicates.
Author:
Christian Ohr
See Also:
  • Constructor Details

  • Method Details

    • isEqual

      public Predicate isEqual(Object expected)
      Parameters:
      expected - expected value
      Returns:
      a predicate that evaluates to true if the expected value equals the actual value
    • isEqualIgnoreCase

      public Predicate isEqualIgnoreCase(Object expected)
      Parameters:
      expected - expected value
      Returns:
      a predicate that evaluates to true if the expected value case-insensitively equals the actual value
    • empty

      public Predicate empty()
      Returns:
      a predicate that evaluates to true if the actual value is null, has zero length or is explicitly "empty" as HL7 defines it ("").
    • emptyOr

      public Predicate emptyOr(Predicate predicate)
      Parameters:
      predicate - the predicate to evaluate if not empty
      Returns:
      a predicate that evaluates to true if the actual value is empty or the passed predicate evaluates to true.
    • matches

      public Predicate matches(String regex)
      Parameters:
      regex - regular expression
      Returns:
      a predicate that evaluates to true if the actual value matches the regular expression
    • matches

      public Predicate matches(String regex, String description)
      Parameters:
      regex - regular expression
      description - custom descriptiom for this regex
      Returns:
      a predicate that evaluates to true if the actual value matches the regular expression
    • startsWith

      public Predicate startsWith(String prefix)
      Parameters:
      prefix - prefix string
      Returns:
      a predicate that evaluates to true if the actual value starts with the specified prefix.
    • nonNegativeInteger

      Returns:
      a predicate that evaluates to true if the actual value can be parsed into a non-negative integer.
    • number

      public Predicate number()
      Returns:
      a predicate that evaluates to true if the actual value can be parsed into a number with optional decimal digits.
    • date

      public Predicate date()
      Returns:
      a predicate that evaluates to true if the actual value matches a HL7 date pattern (YYYY[MM[DD]])
    • time

      public Predicate time()
      Returns:
      a predicate that evaluates to true if the actual value matches a HL7 time pattern
    • dateTime

      public Predicate dateTime()
      Returns:
      a predicate that evaluates to true if the actual value matches a HL7 datetime pattern
    • dateTime25

      Returns:
      a predicate that evaluates to true if the actual value matches a HL7 datetime pattern
    • usPhoneNumber

      Returns:
      a predicate that evaluates to true if the actual value matches a US phone number pattern
    • oid

      public Predicate oid()
      Returns:
      a predicate that evaluates to true if the actual value matches an ISO OID pattern
    • uuid

      public Predicate uuid()
      Returns:
      a predicate that evaluates to true if the actual value matches a UUID pattern
    • matches

      public Predicate matches(String regex, int flags)
      Parameters:
      regex - regular expression
      flags - regular expression flags
      Returns:
      a predicate that evaluates to true if the actual value matches the regular expression
    • in

      public Predicate in(Object... allowed)
      Equivalent with allOf(isEqual(allowed[0]), ..., isEqual(allowed[n-1])
      Parameters:
      allowed - allowed values
      Returns:
      a predicate that evaluates to true if the actual value occurs in he specified array of objects
    • in

      public Predicate in(Collection<?> allowed)
      Parameters:
      allowed - allowed values
      Returns:
      a predicate that evaluates to true if the actual value occurs in he specified collection of objects
    • anyOf

      public Predicate anyOf(Iterable<Predicate> predicates)
      Parameters:
      predicates - predicates of which one shall evaluate to true
      Returns:
      a predicate that evaluates to true if any of the specified predicates evaluates to true
    • allOf

      public Predicate allOf(Iterable<Predicate> predicates)
      Parameters:
      predicates - predicates of which all shall evaluate to true
      Returns:
      a predicate that evaluates to true if all of the specified predicates evaluate to true
    • anyOf

      public Predicate anyOf(Predicate... predicates)
      Parameters:
      predicates - predicates of which one shall evaluate to true
      Returns:
      a predicate that evaluates to true if any of the specified predicates evaluates to true
    • allOf

      public Predicate allOf(Predicate... predicates)
      Parameters:
      predicates - predicates of which all shall evaluate to true
      Returns:
      a predicate that evaluates to true if all of the specified predicates evaluate to true
    • not

      public Predicate not(Predicate predicate)
      Parameters:
      predicate - predicate to be negated
      Returns:
      a predicate that evaluates to true if the specified predicate evaluate to false
    • maxLength

      public Predicate maxLength(int maxSize)
      Parameters:
      maxSize - maximal length of the value
      Returns:
      a predicate that evaluates to true if the length of the actual value is equal or shorter than the specified length
    • withdrawn

      public Predicate withdrawn()
      Returns:
      a predicate that evaluates to false giving the reason that the message element has been withdrawn and should not be used anymore.
    • always

      public Predicate always(boolean b)
      Returns:
      a predicate that evaluates to the specified boolean value
    • alwaysFails

      Returns:
      a predicate that evaluates to false