ca.uhn.hl7v2.validation.impl
Class RegexPrimitiveRule

java.lang.Object
  extended by ca.uhn.hl7v2.validation.impl.RegexPrimitiveRule
All Implemented Interfaces:
PrimitiveTypeRule, Rule, java.io.Serializable

public class RegexPrimitiveRule
extends java.lang.Object
implements PrimitiveTypeRule

A PrimitiveTypeRule that validates primitive values using a regular expression.

Version:
$Revision: 1.1 $ updated on $Date: 2007/02/19 02:24:40 $ by $Author: jamesagnew $
Author:
Bryan Tripp
See Also:
Serialized Form

Constructor Summary
RegexPrimitiveRule(java.lang.String theRegex, java.lang.String theSectionReference)
           
 
Method Summary
 java.lang.String correct(java.lang.String value)
          Optionally performs an automatic correction on given data to make it conform (eg trims leading whitespace).
 java.lang.String getDescription()
          Returns a text description of the rule.
 java.lang.String getSectionReference()
          A string indicating the section of the HL7 standard from which this rule is derived (if applicable).
 boolean test(java.lang.String value)
          Empty string, null, and the HL7 explicit null (two double-quotes) are passed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegexPrimitiveRule

public RegexPrimitiveRule(java.lang.String theRegex,
                          java.lang.String theSectionReference)
Parameters:
theRegex - a regular expression against which to validate primitive values
theSectionReference - to be returned by getSectionReference()
Method Detail

test

public boolean test(java.lang.String value)
Empty string, null, and the HL7 explicit null (two double-quotes) are passed.

Specified by:
test in interface PrimitiveTypeRule
See Also:
PrimitiveTypeRule.test(java.lang.String)

getDescription

public java.lang.String getDescription()
Description copied from interface: Rule
Returns a text description of the rule. This description may be used as a message in exceptions generated if validation against the rule fails, or in a user interface for rule configuration.

Specified by:
getDescription in interface Rule
See Also:
Rule.getDescription()

getSectionReference

public java.lang.String getSectionReference()
Description copied from interface: Rule
A string indicating the section of the HL7 standard from which this rule is derived (if applicable). Like the description, this may be used in an exception message or configuration UI.

Specified by:
getSectionReference in interface Rule
See Also:
Rule.getSectionReference()

correct

public java.lang.String correct(java.lang.String value)
Description copied from interface: PrimitiveTypeRule
Optionally performs an automatic correction on given data to make it conform (eg trims leading whitespace). This is to be called prior to test(). If no corrections are performed, the original value is returned.

Specified by:
correct in interface PrimitiveTypeRule
Parameters:
value - an original value to be corrected
Returns:
a corrected version of the given value
See Also:
PrimitiveTypeRule.correct(java.lang.String)


Copyright © 2001-2011 University Health Network. All Rights Reserved.