public class PredicatePrimitiveTypeRule extends AbstractPrimitiveTypeRule implements PredicateRuleSupport<String>
Modifier and Type | Class and Description |
---|---|
static class |
PredicatePrimitiveTypeRule.Trimmer |
Constructor and Description |
---|
PredicatePrimitiveTypeRule(Predicate predicate)
Creates a new primitive rule without trimming
|
PredicatePrimitiveTypeRule(Predicate predicate,
PredicatePrimitiveTypeRule.Trimmer trimmer)
Creates a new primitive rule
|
Modifier and Type | Method and Description |
---|---|
ValidationException[] |
apply(String value)
Applies to rule to an object to be checked
|
String |
correct(String value)
Optionally performs an automatic correction on given data to make it
conform (eg trims leading whitespace).
|
Predicate |
getPredicate() |
boolean |
test(String value)
Tests the given string against the criteria defined by this
rule -- returns true if it passes the test, false otherwise.
|
String |
toString() |
failed, failed, failed, failed, failedWithValue, getDescription, getErrorCode, getSectionReference, getSeverity, passed, result, result, setDescription, setErrorCode, setSectionReference, setSeverity
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getDescription, getSectionReference
public PredicatePrimitiveTypeRule(Predicate predicate)
predicate
- predicate to be usedpublic PredicatePrimitiveTypeRule(Predicate predicate, PredicatePrimitiveTypeRule.Trimmer trimmer)
predicate
- predicate to be usedtrimmer
- trimming behaviorpublic Predicate getPredicate()
getPredicate
in interface PredicateRuleSupport<String>
public String correct(String value)
PrimitiveTypeRule
correct
in interface PrimitiveTypeRule
correct
in class AbstractPrimitiveTypeRule
value
- an original value to be correctedpublic boolean test(String value)
PrimitiveTypeRule
test
in interface PrimitiveTypeRule
test
in class AbstractPrimitiveTypeRule
public ValidationException[] apply(String value)
Rule
Copyright © 2001–2017 University Health Network. All rights reserved.