Package ca.uhn.hl7v2.validation.builder
Class PredicatePrimitiveTypeRule
java.lang.Object
ca.uhn.hl7v2.validation.impl.RuleSupport<String>
ca.uhn.hl7v2.validation.impl.AbstractPrimitiveTypeRule
ca.uhn.hl7v2.validation.builder.PredicatePrimitiveTypeRule
- All Implemented Interfaces:
PredicateRuleSupport<String>,PrimitiveTypeRule,Rule<String>,Serializable
public class PredicatePrimitiveTypeRule
extends AbstractPrimitiveTypeRule
implements PredicateRuleSupport<String>
Abstract base class for PrimitiveTypeRules that validate using predicates
- Author:
- Christian Ohr
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionPredicatePrimitiveTypeRule(Predicate predicate) Creates a new primitive rule without trimmingPredicatePrimitiveTypeRule(Predicate predicate, PredicatePrimitiveTypeRule.Trimmer trimmer) Creates a new primitive rule -
Method Summary
Modifier and TypeMethodDescriptionApplies to rule to an object to be checkedOptionally performs an automatic correction on given data to make it conform (eg trims leading whitespace).booleanTests the given string against the criteria defined by this rule -- returns true if it passes the test, false otherwise.toString()Methods inherited from class ca.uhn.hl7v2.validation.impl.RuleSupport
failed, failed, failed, failed, failedWithValue, getDescription, getErrorCode, getSectionReference, getSeverity, passed, result, result, setDescription, setErrorCode, setSectionReference, setSeverityMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ca.uhn.hl7v2.validation.Rule
getDescription, getSectionReference
-
Constructor Details
-
PredicatePrimitiveTypeRule
Creates a new primitive rule without trimming- Parameters:
predicate- predicate to be used
-
PredicatePrimitiveTypeRule
Creates a new primitive rule- Parameters:
predicate- predicate to be usedtrimmer- trimming behavior
-
-
Method Details
-
getPredicate
- Specified by:
getPredicatein interfacePredicateRuleSupport<String>- Returns:
- the predicate instance used to test
-
correct
Description copied from interface:PrimitiveTypeRuleOptionally 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:
correctin interfacePrimitiveTypeRule- Overrides:
correctin classAbstractPrimitiveTypeRule- Parameters:
value- an original value to be corrected- Returns:
- a corrected version of the given value
-
test
Description copied from interface:PrimitiveTypeRuleTests the given string against the criteria defined by this rule -- returns true if it passes the test, false otherwise.- Specified by:
testin interfacePrimitiveTypeRule- Overrides:
testin classAbstractPrimitiveTypeRule
-
apply
Description copied from interface:RuleApplies to rule to an object to be checked -
toString
-