Class LikeExpressionStateObject
- java.lang.Object
-
- org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
-
- org.eclipse.persistence.jpa.jpql.tools.model.query.LikeExpressionStateObject
-
- All Implemented Interfaces:
StateObject
public class LikeExpressionStateObject extends AbstractStateObject
TheLIKEcondition is used to specify a search for a pattern.The
string_expressionmust have a string value. Thepattern_valueis a string literal or a string-valued input parameter in which an underscore (_) stands for any single character, a percent (%) character stands for any sequence of characters (including the empty sequence), and all other characters stand for themselves. The optionalescape_characteris a single-character string literal or a character-valued input parameter (i.e., char or Character) and is used to escape the special meaning of the underscore and percent characters inpattern_value.BNF:like_expression ::= string_expression [NOT] LIKE pattern_value [ESCAPE escape_character]- Since:
- 2.4
- Version:
- 2.4
- Author:
- Pascal Filion
- See Also:
LikeExpression
-
-
Field Summary
Fields Modifier and Type Field Description static StringESCAPE_CHARACTER_PROPERTYNotifies the escape character property has changed.static StringNOT_PROPERTYNotifies the visibility of theNOTidentifier has changed.static StringPATTERN_VALUE_PROPERTYNotifies the pattern value property has changed.static StringSTRING_STATE_OBJECT_PROPERTYNotifies the string state object property has changed.
-
Constructor Summary
Constructors Constructor Description LikeExpressionStateObject(StateObject parent)Creates a newLikeExpressionStateObject.LikeExpressionStateObject(StateObject parent, StateObject stringStateObject)Creates a newLikeExpressionStateObject.LikeExpressionStateObject(StateObject parent, StateObject stringStateObject, boolean not, StateObject patternValue, String escapeCharacter)Creates a newLikeExpressionStateObject.LikeExpressionStateObject(StateObject parent, StateObject stringStateObject, StateObject patternValue)Creates a newLikeExpressionStateObject.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(StateObjectVisitor visitor)Visits thisStateObjectby the givenvisitor.LikeExpressionStateObjectaddNot()Makes sure theNOTidentifier is specified.StringgetEscapeCharacter()LikeExpressiongetExpression()Returns the actual parsed object if thisStateObjectrepresentation of the JPQL query was created by parsing an existing JPQL query.StateObjectgetPatternValue()StateObjectgetStringStateObject()booleanhasEscapeCharacter()booleanhasNot()Determines whether theNOTidentifier is used or not.booleanhasPatternValue()booleanhasStringStateObject()booleanisEquivalent(StateObject stateObject)Determines whether the givenStateObjectis equivalent to this one, i.e.voidremoveNot()Makes sure theNOTidentifier is not specified.voidsetEscapeCharacter(String escapeCharacter)voidsetExpression(LikeExpression expression)Keeps a reference of theparsed objectobject, which should only be done when this object is instantiated during the conversion of a parsed JPQL query intoStateObjects.voidsetNot(boolean not)Sets whether theNOTidentifier should be part of the expression or not.voidsetPatternValue(StateObject patternValue)voidsetStringStateObject(StateObject stringStateObject)voidtoggleNot()Changes the visibility state of theNOTidentifier.-
Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
addPropertyChangeListener, children, decorate, equals, findIdentificationVariable, getDeclaration, getDecorator, getGrammar, getManagedTypeProvider, getParent, getQueryBuilder, getRoot, getType, getType, getTypeHelper, getTypeRepository, hashCode, isDecorated, removePropertyChangeListener, setExpression, setParent, toString, toString, toText
-
-
-
-
Field Detail
-
ESCAPE_CHARACTER_PROPERTY
public static final String ESCAPE_CHARACTER_PROPERTY
Notifies the escape character property has changed.- See Also:
- Constant Field Values
-
NOT_PROPERTY
public static String NOT_PROPERTY
Notifies the visibility of theNOTidentifier has changed.
-
PATTERN_VALUE_PROPERTY
public static final String PATTERN_VALUE_PROPERTY
Notifies the pattern value property has changed.- See Also:
- Constant Field Values
-
STRING_STATE_OBJECT_PROPERTY
public static final String STRING_STATE_OBJECT_PROPERTY
Notifies the string state object property has changed.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
LikeExpressionStateObject
public LikeExpressionStateObject(StateObject parent)
Creates a newLikeExpressionStateObject.- Parameters:
parent- The parent of this state object, which cannot benull- Throws:
NullPointerException- The given parent cannot benull
-
LikeExpressionStateObject
public LikeExpressionStateObject(StateObject parent, StateObject stringStateObject)
Creates a newLikeExpressionStateObject.- Parameters:
parent- The parent of this state object, which cannot benullstringStateObject- TheStateObjectrepresenting the string expression- Throws:
NullPointerException- The given parent cannot benull
-
LikeExpressionStateObject
public LikeExpressionStateObject(StateObject parent, StateObject stringStateObject, boolean not, StateObject patternValue, String escapeCharacter)
Creates a newLikeExpressionStateObject.- Parameters:
parent- The parent of this state object, which cannot benullstringStateObject- TheStateObjectrepresenting the string expressionnot- Determines whether theNOTidentifier is part of the expression or notpatternValue- A string literal or a string-valued input parameter in which an underscore (_) stands for any single character, a percent (%) character stands for any sequence of characters (including the empty sequence), and all other characters stand for themselvesescapeCharacter- A single-character string literal or a character-valued input parameter (i.e., char or Character) and is used to escape the special meaning of the underscore and percent characters inpattern_value- Throws:
NullPointerException- The given parent cannot benull
-
LikeExpressionStateObject
public LikeExpressionStateObject(StateObject parent, StateObject stringStateObject, StateObject patternValue)
Creates a newLikeExpressionStateObject.- Parameters:
parent- The parent of this state object, which cannot benullstringStateObject- TheStateObjectrepresenting the string expressionpatternValue- a string literal or a string-valued input parameter in which an underscore (_) stands for any single character, a percent (%) character stands for any sequence of characters (including the empty sequence), and all other characters stand for themselves- Throws:
NullPointerException- The given parent cannot benull
-
-
Method Detail
-
accept
public void accept(StateObjectVisitor visitor)
Visits thisStateObjectby the givenvisitor.- Parameters:
visitor- Thevisitorto visit this object
-
addNot
public LikeExpressionStateObject addNot()
Makes sure theNOTidentifier is specified.- Returns:
- This object
-
getEscapeCharacter
public String getEscapeCharacter()
-
getExpression
public LikeExpression getExpression()
Returns the actual parsed object if thisStateObjectrepresentation of the JPQL query was created by parsing an existing JPQL query.- Specified by:
getExpressionin interfaceStateObject- Overrides:
getExpressionin classAbstractStateObject- Returns:
- The parsed object when a JPQL query is parsed and converted into a
StateObjectornullwhen the JPQL query is manually created (i.e. not from a string)
-
getPatternValue
public StateObject getPatternValue()
-
getStringStateObject
public StateObject getStringStateObject()
-
hasEscapeCharacter
public boolean hasEscapeCharacter()
-
hasNot
public boolean hasNot()
Determines whether theNOTidentifier is used or not.- Returns:
trueif theNOTidentifier is part of the expression;falseotherwise
-
hasPatternValue
public boolean hasPatternValue()
-
hasStringStateObject
public boolean hasStringStateObject()
-
isEquivalent
public boolean isEquivalent(StateObject stateObject)
Determines whether the givenStateObjectis equivalent to this one, i.e. the information of bothStateObjectis the same.- Specified by:
isEquivalentin interfaceStateObject- Overrides:
isEquivalentin classAbstractStateObject- Parameters:
stateObject- TheStateObjectto compare its content to this one- Returns:
trueif both object are equivalent;falseotherwise
-
removeNot
public void removeNot()
Makes sure theNOTidentifier is not specified.
-
setEscapeCharacter
public void setEscapeCharacter(String escapeCharacter)
-
setExpression
public void setExpression(LikeExpression expression)
Keeps a reference of theparsed objectobject, which should only be done when this object is instantiated during the conversion of a parsed JPQL query intoStateObjects.- Parameters:
expression- Theparsed objectrepresenting aLIKEexpression
-
setNot
public void setNot(boolean not)
Sets whether theNOTidentifier should be part of the expression or not.- Parameters:
not-trueif theNOTidentifier should be part of the expression;falseotherwise
-
setPatternValue
public void setPatternValue(StateObject patternValue)
-
setStringStateObject
public void setStringStateObject(StateObject stringStateObject)
-
toggleNot
public void toggleNot()
Changes the visibility state of theNOTidentifier.
-
-