ca.uhn.hl7v2.validation.impl
Class SizeRule

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

public class SizeRule
extends java.lang.Object
implements PrimitiveTypeRule

Checks that Primitive values conform to a certain size limit.

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
SizeRule(int theMaxChars)
           
 
Method Summary
 java.lang.String correct(java.lang.String value)
          Does nothing.
 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)
          Tests the given string against the criteria defined by this rule -- returns true if it passes the test, false otherwise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SizeRule

public SizeRule(int theMaxChars)
Parameters:
theMaxChars - the maximum number of characters this rule allows in a primitive value
Method Detail

correct

public java.lang.String correct(java.lang.String value)
Does nothing. If what you wanted was to trim the value to the max size, you should make a separate rule for that.

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)

test

public boolean test(java.lang.String value)
Description copied from interface: PrimitiveTypeRule
Tests the given string against the criteria defined by this rule -- returns true if it passes the test, false otherwise.

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()


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