public final class CriterionFactory extends Object
The method parse(String)
takes as input what is presumed to be the
string representation of some criterion and returns an equivalent
Criterion
instance.
CriterionFactory.parse("answer=42")
is semantically
equivalent to new SingleValuedCriterion("answer", "42")
.
Modifier and Type | Class and Description |
---|---|
static class |
CriterionFactory.EmptyCriterionException
Describes
CriterionFactory.InvalidCriterionException instances that are thrown
when dealing with empty criteria. |
static class |
CriterionFactory.InvalidCriterionException
Describes
IllegalArgumentException instances that are thrown when
dealing with malformed string representations of criteria. |
Modifier and Type | Method and Description |
---|---|
static boolean |
isValidAttributeName(CharSequence str)
Tells whether the given string represents a valid attribute name (or a
valid function name, or a valid universe or locale ID, for that matter).
|
static Criterion |
parse(String criterion)
Converts the string representation of a criterion into an equivalent
Criterion instance. |
public static Criterion parse(String criterion)
Criterion
instance.criterion
- The non-null
string representation of the criterion
that is to be parsed.Criterion
that matches the input.CriterionFactory.EmptyCriterionException
- If criterion is null
, empty, or consists
of nothing but an exclamation mark (i.e., a negation without
operand).CriterionFactory.InvalidCriterionException
- If criterion cannot be parsed (i.e., does not
represent a valid criterion).public static boolean isValidAttributeName(CharSequence str)
More specifically, attribute names must match the pattern
[0-9a-zA-Z_]+
.
str
- The string to test.true
if str can be an attribute name, universe
or locale; false
otherwise.Copyright © 2021 RWS Group for and on behalf of its affiliates and subsidiaries. All rights reserved.