Top Description Fields Constructors Methods
org.eclipse.persistence.jpa.jpql.tools.model.query

public Class LikeExpressionStateObject

extends AbstractStateObject
Class Inheritance
Annotations
@SuppressWarnings:nls, unused
Imports
java.io.IOException, java.util.List, org.eclipse.persistence.jpa.jpql.parser.LikeExpression

The LIKE condition is used to specify a search for a pattern.

The string_expression must have a string value. The pattern_value is 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 optional escape_character is 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 in pattern_value.

BNF: like_expression ::= string_expression [NOT] LIKE pattern_value [ESCAPE escape_character]

Author
Pascal Filion
Since
2.4
Version
2.4
See Also
LikeExpression

Field Summary

Modifier and TypeField and Description
public static final String
ESCAPE_CHARACTER_PROPERTY

Notifies the escape character property has changed.

private StringLiteralStateObject
private boolean
not

Determines whether the NOT identifier is part of the expression or not.

public static final String
NOT_PROPERTY

Notifies the visibility of the NOT identifier has changed.

public static final String
PATTERN_VALUE_PROPERTY

Notifies the pattern value property has changed.

private StateObject
public static final String
STRING_STATE_OBJECT_PROPERTY

Notifies the string state object property has changed.

private StateObject

Constructor Summary

AccessConstructor and Description
public
LikeExpressionStateObject(StateObject
The parent of this state object, which cannot be null
parent
)

Creates a new LikeExpressionStateObject.

public
LikeExpressionStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
StateObject
The StateObject representing the string expression
stringStateObject
)

Creates a new LikeExpressionStateObject.

public
LikeExpressionStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
StateObject
The StateObject representing the string expression
stringStateObject
,
boolean
Determines whether the NOT identifier is part of the expression or not
not
,
StateObject
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
patternValue
,
String
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 in pattern_value
escapeCharacter
)

Creates a new LikeExpressionStateObject.

public
LikeExpressionStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
StateObject
The StateObject representing the string expression
stringStateObject
,
StateObject
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
patternValue
)

Creates a new LikeExpressionStateObject.

Method Summary

Modifier and TypeMethod and Description
public void
protected void
addChildren(List<StateObject>
The list used to store the children
children
)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.addChildren.

Adds the children of this StateObject to the given list.
public LikeExpressionStateObject

Returns:

This object
addNot
()

Makes sure the NOT identifier is specified.

public String
public LikeExpression
getExpression()

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.getExpression.

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.getExpression.

Returns the actual parsed object if this StateObject representation of the JPQL query was created by parsing an existing JPQL query.
public StateObject
public StateObject
public boolean
public boolean

Returns:

true if the NOT identifier is part of the expression; false otherwise
hasNot
()

Determines whether the NOT identifier is used or not.

public boolean
public boolean
protected void
public boolean
isEquivalent(StateObject
The StateObject to compare its content to this one
stateObject
)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.isEquivalent.

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.isEquivalent.

Determines whether the given StateObject is equivalent to this one, i.e. the information of both StateObject is the same.
public void
removeNot()

Makes sure the NOT identifier is not specified.

public void
setEscapeCharacter(String escapeCharacter)

public void
setExpression(LikeExpression
The parsed object representing a LIKE expression
expression
)

Keeps a reference of the parsed object object, which should only be done when this object is instantiated during the conversion of a parsed JPQL query into StateObjects.

public void
setNot(boolean
true if the NOT identifier should be part of the expression; false otherwise
not
)

Sets whether the NOT identifier should be part of the expression or not.

public void
public void
setStringStateObject(StateObject stringStateObject)

public void
toggleNot()

Changes the visibility state of the NOT identifier.

protected void
toTextInternal(Appendable
The writer used to print out the string representation
writer
)

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.toTextInternal.

Prints out a string representation of this StateObject, which should not be used to define a true string representation of a JPQL query but should be used for debugging purposes.
Inherited from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject:
acceptUnknownVisitoracceptUnknownVisitoraddProblemsaddPropertyChangeListenerareEquivalentbuildProblembuildProblembuildStateObjectbuildStateObjectscheckParentchildrendecorateequalsfindIdentificationVariablefirePropertyChangedgetChangeSupportgetDeclarationgetDecoratorgetGrammargetManagedTypeProvidergetParentgetQueryBuildergetRootgetTypegetTypegetTypeHelpergetTypeRepositoryhashCodeisDecoratedparentparentparentremovePropertyChangeListenersetExpressionsetParenttoStringtoStringtoStringInternaltoStringItemstoText

Field Detail

ESCAPE_CHARACTER_PROPERTYback to summary
public static final String ESCAPE_CHARACTER_PROPERTY

Notifies the escape character property has changed.

escapeCharacterback to summary
private StringLiteralStateObject escapeCharacter
notback to summary
private boolean not

Determines whether the NOT identifier is part of the expression or not.

NOT_PROPERTYback to summary
public static final String NOT_PROPERTY

Notifies the visibility of the NOT identifier has changed.

PATTERN_VALUE_PROPERTYback to summary
public static final String PATTERN_VALUE_PROPERTY

Notifies the pattern value property has changed.

patternValueback to summary
private StateObject patternValue
STRING_STATE_OBJECT_PROPERTYback to summary
public static final String STRING_STATE_OBJECT_PROPERTY

Notifies the string state object property has changed.

stringStateObjectback to summary
private StateObject stringStateObject

Constructor Detail

LikeExpressionStateObjectback to summary
public LikeExpressionStateObject(StateObject parent)

Creates a new LikeExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

Exceptions
NullPointerException:
The given parent cannot be null
LikeExpressionStateObjectback to summary
public LikeExpressionStateObject(StateObject parent, StateObject stringStateObject)

Creates a new LikeExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

stringStateObject:StateObject

The StateObject representing the string expression

Exceptions
NullPointerException:
The given parent cannot be null
LikeExpressionStateObjectback to summary
public LikeExpressionStateObject(StateObject parent, StateObject stringStateObject, boolean not, StateObject patternValue, String escapeCharacter)

Creates a new LikeExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

stringStateObject:StateObject

The StateObject representing the string expression

not:boolean

Determines whether the NOT identifier is part of the expression or not

patternValue:StateObject

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

escapeCharacter:String

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 in pattern_value

Exceptions
NullPointerException:
The given parent cannot be null
LikeExpressionStateObjectback to summary
public LikeExpressionStateObject(StateObject parent, StateObject stringStateObject, StateObject patternValue)

Creates a new LikeExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

stringStateObject:StateObject

The StateObject representing the string expression

patternValue:StateObject

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

Exceptions
NullPointerException:
The given parent cannot be null

Method Detail

acceptback to summary
public void accept(StateObjectVisitor visitor)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.accept.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.accept.

Visits this StateObject by the given visitor.

Parameters
visitor:StateObjectVisitor

The visitor to visit this object

Annotations
@Override
addChildrenback to summary
protected void addChildren(List<StateObject> children)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.addChildren.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.addChildren.

Adds the children of this StateObject to the given list.

Parameters
children:List<StateObject>

The list used to store the children

Annotations
@Override
addNotback to summary
public LikeExpressionStateObject addNot()

Makes sure the NOT identifier is specified.

Returns:LikeExpressionStateObject

This object

getEscapeCharacterback to summary
public String getEscapeCharacter()
getExpressionback to summary
public LikeExpression getExpression()

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.getExpression.

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.getExpression.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.getExpression.

Returns the actual parsed object if this StateObject representation of the JPQL query was created by parsing an existing JPQL query.

Returns:LikeExpression

The parsed object when a JPQL query is parsed and converted into a StateObject or null when the JPQL query is manually created (i.e. not from a string)

Annotations
@Override
getPatternValueback to summary
public StateObject getPatternValue()
getStringStateObjectback to summary
public StateObject getStringStateObject()
hasEscapeCharacterback to summary
public boolean hasEscapeCharacter()
hasNotback to summary
public boolean hasNot()

Determines whether the NOT identifier is used or not.

Returns:boolean

true if the NOT identifier is part of the expression; false otherwise

hasPatternValueback to summary
public boolean hasPatternValue()
hasStringStateObjectback to summary
public boolean hasStringStateObject()
initializeback to summary
protected void initialize()

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.initialize.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.initialize.

Initializes this state object.

Annotations
@Override
isEquivalentback to summary
public boolean isEquivalent(StateObject stateObject)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.isEquivalent.

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.isEquivalent.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.isEquivalent.

Determines whether the given StateObject is equivalent to this one, i.e. the information of both StateObject is the same.

Parameters
stateObject:StateObject

The StateObject to compare its content to this one

Returns:boolean

true if both object are equivalent; false otherwise

Annotations
@Override
removeNotback to summary
public void removeNot()

Makes sure the NOT identifier is not specified.

setEscapeCharacterback to summary
public void setEscapeCharacter(String escapeCharacter)
setExpressionback to summary
public void setExpression(LikeExpression expression)

Keeps a reference of the parsed object object, which should only be done when this object is instantiated during the conversion of a parsed JPQL query into StateObjects.

Parameters
expression:LikeExpression

The parsed object representing a LIKE expression

setNotback to summary
public void setNot(boolean not)

Sets whether the NOT identifier should be part of the expression or not.

Parameters
not:boolean

true if the NOT identifier should be part of the expression; false otherwise

setPatternValueback to summary
public void setPatternValue(StateObject patternValue)
setStringStateObjectback to summary
public void setStringStateObject(StateObject stringStateObject)
toggleNotback to summary
public void toggleNot()

Changes the visibility state of the NOT identifier.

toTextInternalback to summary
protected void toTextInternal(Appendable writer) throws IOException

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.toTextInternal.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.toTextInternal.

Prints out a string representation of this StateObject, which should not be used to define a true string representation of a JPQL query but should be used for debugging purposes.

Parameters
writer:Appendable

The writer used to print out the string representation

Annotations
@Override
Exceptions
IOException:
This should never happens, it is only required because Appendable is used instead of any concrete class