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]- Version:
- 2.4
- See Also:
LikeExpression- Author:
- Pascal Filion
- Since:
- 2.4
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringESCAPE_CHARACTER_PROPERTYNotifies the escape character property has changed.static java.lang.StringNOT_PROPERTYNotifies the visibility of theNOTidentifier has changed.static java.lang.StringPATTERN_VALUE_PROPERTYNotifies the pattern value property has changed.static java.lang.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, java.lang.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.protected voidaddChildren(java.util.List<StateObject> children)Adds the children of thisStateObjectto the given list.LikeExpressionStateObjectaddNot()Makes sure theNOTidentifier is specified.java.lang.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()protected voidinitialize()Initializes this state object.booleanisEquivalent(StateObject stateObject)Determines whether the givenStateObjectis equivalent to this one, i.e. the information of bothStateObjectis the same.voidremoveNot()Makes sure theNOTidentifier is not specified.voidsetEscapeCharacter(java.lang.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.protected voidtoTextInternal(java.lang.Appendable writer)Prints out a string representation of thisStateObject, which should not be used to define atruestring representation of a JPQL query but should be used for debugging purposes.-
Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
acceptUnknownVisitor, acceptUnknownVisitor, addProblems, addPropertyChangeListener, areEquivalent, buildProblem, buildProblem, buildStateObject, buildStateObjects, checkParent, children, decorate, equals, findIdentificationVariable, firePropertyChanged, getChangeSupport, getDeclaration, getDecorator, getGrammar, getManagedTypeProvider, getParent, getQueryBuilder, getRoot, getType, getType, getTypeHelper, getTypeRepository, hashCode, isDecorated, parent, parent, parent, removePropertyChangeListener, setExpression, setParent, toString, toString, toStringInternal, toStringItems, toText
-
-
-
-
Field Detail
-
ESCAPE_CHARACTER_PROPERTY
public static final java.lang.String ESCAPE_CHARACTER_PROPERTY
Notifies the escape character property has changed.- See Also:
- Constant Field Values
-
NOT_PROPERTY
public static final java.lang.String NOT_PROPERTY
Notifies the visibility of theNOTidentifier has changed.- See Also:
- Constant Field Values
-
PATTERN_VALUE_PROPERTY
public static final java.lang.String PATTERN_VALUE_PROPERTY
Notifies the pattern value property has changed.- See Also:
- Constant Field Values
-
STRING_STATE_OBJECT_PROPERTY
public static final java.lang.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:
java.lang.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:
java.lang.NullPointerException- The given parent cannot benull
-
LikeExpressionStateObject
public LikeExpressionStateObject(StateObject parent, StateObject stringStateObject, boolean not, StateObject patternValue, java.lang.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:
java.lang.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:
java.lang.NullPointerException- The given parent cannot benull
-
-
Method Detail
-
accept
public void accept(StateObjectVisitor visitor)
Visits thisStateObjectby the givenvisitor.- Parameters:
visitor- Thevisitorto visit this object
-
addChildren
protected void addChildren(java.util.List<StateObject> children)
Adds the children of thisStateObjectto the given list.- Overrides:
addChildrenin classAbstractStateObject- Parameters:
children- The list used to store the children
-
addNot
public LikeExpressionStateObject addNot()
Makes sure theNOTidentifier is specified.- Returns:
- This object
-
getEscapeCharacter
public java.lang.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()
-
initialize
protected void initialize()
Initializes this state object.- Overrides:
initializein classAbstractStateObject
-
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(java.lang.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.
-
toTextInternal
protected void toTextInternal(java.lang.Appendable writer) throws java.io.IOExceptionPrints out a string representation of thisStateObject, which should not be used to define atruestring representation of a JPQL query but should be used for debugging purposes.- Specified by:
toTextInternalin classAbstractStateObject- Parameters:
writer- The writer used to print out the string representation- Throws:
java.io.IOException- This should never happens, it is only required becauseAppendableis used instead of any concrete class
-
-