public final class LikeCondition extends Condition
Condition
that represents a pattern-matching condition that compares the values of StringExpression
objects. The operators of a LikeCondition
specify a test that can match patterns defined by special pattern-matching ("wildcard") characters.
The left-hand-side expression of a LikeCondition
specifies the text expression to search.
The operator is one of the constants of the class, which are LIKE
, LIKEC
, LIKE2
, and LIKE4
.
The right-hand-side expression specifies the pattern to search for. The pattern can contain these wildcard characters:
The escape expression is a text expression, usually a literal, that is one character long. This escape character identifies an underscore or a percent sign in the pattern as a literal character instead of a wildcard character. You can also search for the escape character itself by repeating it. For example, if @ is the escape character, then you can use @% to search for % and @@ to search for @.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
LIKE
A constant for an operator that tests characters in the input character set.
|
static java.lang.String |
LIKE2
A constant for an operator that tests UCS2 code points.
|
static java.lang.String |
LIKE4
A constant for an operator that tests UCS4 code points.
|
static java.lang.String |
LIKEC
A constant for an operator that tests Unicode complete characters.
|
Constructor and Description |
---|
LikeCondition(TypedExpression lhsExpression, java.lang.String operator, TypedExpression rhsExpression)
Creates a
LikeCondition that has the specified left-hand-side expression, operator, and right-hand-side expression, does not have an escape character, and is not negated. |
LikeCondition(TypedExpression lhsExpression, java.lang.String operator, TypedExpression rhsExpression, TypedExpression escapeExpression, boolean negate)
Creates a
LikeCondition that has the specified left-hand-side expression, operator, right-hand-side expression, escape character, and negation indicator. |
Modifier and Type | Method and Description |
---|---|
TypedExpression |
getEscapeExpression()
Gets the escape expression for this
LikeCondition . |
TypedExpression |
getLhsExpression()
Gets the expression that is the left-hand-side argument of this
LikeCondition , which contains the text to search. |
java.lang.String |
getOperator()
Gets the operator for this
LikeCondition , which is one of the constants of this class. |
TypedExpression |
getRhsExpression()
Gets the expression that is the right-hand-side argument of this
LikeCondition , which contains the text pattern to search for. |
boolean |
isNegated()
Indicates whether this
LikeCondition includes the NOT operator. |
java.lang.Object |
visit(SyntaxObjectVisitor visitor, java.lang.Object context)
Calls the
visitLikeCondition method of the SyntaxObjectVisitor and passes that method this LikeCondition and an Object . |
and, isCompositeObject, not, or
equals, equals, fromSyntax, fromSyntax, fromSyntax, fromSyntax, fromSyntax, isValid, toSyntax, toSyntax, toSyntax, toSyntax, toSyntax, toSyntax
public static final java.lang.String LIKE
public static final java.lang.String LIKEC
public static final java.lang.String LIKE2
public static final java.lang.String LIKE4
public LikeCondition(TypedExpression lhsExpression, java.lang.String operator, TypedExpression rhsExpression, TypedExpression escapeExpression, boolean negate)
LikeCondition
that has the specified left-hand-side expression, operator, right-hand-side expression, escape character, and negation indicator.lhsExpression
- A TypedExpression
that has the text expression for the search value.operator
- A LikeCondition
constant that specifies the opeator for the condition test.rhsExpression
- A TypedExpression
that has the text expression for the pattern.escapeExpression
- A TypedExpression
that has the text expression to use as the escape character.negate
- A boolean
that if true
adds NOT
to the operator or if false
does not add NOT
to the operator.public LikeCondition(TypedExpression lhsExpression, java.lang.String operator, TypedExpression rhsExpression)
LikeCondition
that has the specified left-hand-side expression, operator, and right-hand-side expression, does not have an escape character, and is not negated. For a LikeCondition
created by this constructor, the getEscapeExpression
method returns null
and the isNegated
method returns false
.lhsExpression
- A TypedExpression
that has the text expression for the search value.operator
- A LikeCondition
constant that specifies the opeator for the condition test.rhsExpression
- A TypedExpression
that has the text expression for the pattern.public java.lang.Object visit(SyntaxObjectVisitor visitor, java.lang.Object context)
visitLikeCondition
method of the SyntaxObjectVisitor
and passes that method this LikeCondition
and an Object
.visit
in class SyntaxObject
visitor
- A SyntaxObjectVisitor
.context
- An Object
.Object
returned by the visitLikeCondition
method.public boolean isNegated()
LikeCondition
includes the NOT
operator.boolean
that is true
if this LikeCondition
includes the NOT
operator or false
if it does not.public java.lang.String getOperator()
LikeCondition
, which is one of the constants of this class.String
that contains the operator for this LikeCondition
.public TypedExpression getEscapeExpression()
LikeCondition
.String
that contains the escape expression for this LikeCondition
.public TypedExpression getLhsExpression()
LikeCondition
, which contains the text to search.TypedExpression
that is the left-hand-side argument of this LikeCondition
.public TypedExpression getRhsExpression()
LikeCondition
, which contains the text pattern to search for.TypedExpression
that is the right-hand-side argument of this LikeCondition
.