Class NotExpressionStateObject
- java.lang.Object
-
- org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
-
- org.eclipse.persistence.jpa.jpql.tools.model.query.NotExpressionStateObject
-
- All Implemented Interfaces:
StateObject
public class NotExpressionStateObject extends AbstractStateObject
BNF:expression ::= NOT conditional_primary- Version:
- 2.4
- See Also:
NotExpression- Author:
- Pascal Filion
- Since:
- 2.4
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringSTATE_OBJECT_PROPERTYNotifies the state object property has changed.
-
Constructor Summary
Constructors Constructor Description NotExpressionStateObject(StateObject parent)Creates a newNotExpressionStateObject.NotExpressionStateObject(StateObject parent, java.lang.String jpqlFragment)Creates a newNotExpressionStateObject.NotExpressionStateObject(StateObject parent, StateObject stateObject)Creates a newNotExpressionStateObject.
-
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.NotExpressiongetExpression()Returns the actual parsed object if thisStateObjectrepresentation of the JPQL query was created by parsing an existing JPQL query.StateObjectgetStateObject()Returns theStateObjectrepresenting the negated expression.booleanhasStateObject()Determines whether theStateObjectrepresenting the encapsulated expression is present or not.booleanisEquivalent(StateObject stateObject)Determines whether the givenStateObjectis equivalent to this one, i.e. the information of bothStateObjectis the same.voidparse(java.lang.String jpqlFragment)Parses the given JPQL fragment, which represents the negated expression, and creates theStateObject.voidsetExpression(NotExpression 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.voidsetStateObject(StateObject stateObject)Sets the givenStateObjectas the new negated expression.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, initialize, isDecorated, parent, parent, parent, removePropertyChangeListener, setExpression, setParent, toString, toString, toStringInternal, toStringItems, toText
-
-
-
-
Field Detail
-
STATE_OBJECT_PROPERTY
public static final java.lang.String STATE_OBJECT_PROPERTY
Notifies the state object property has changed.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
NotExpressionStateObject
public NotExpressionStateObject(StateObject parent)
Creates a newNotExpressionStateObject.- Parameters:
parent- The parent of this state object, which cannot benull- Throws:
java.lang.NullPointerException- The given parent cannot benull
-
NotExpressionStateObject
public NotExpressionStateObject(StateObject parent, StateObject stateObject)
Creates a newNotExpressionStateObject.- Parameters:
parent- The parent of this state object, which cannot benullstateObject- TheStateObjectrepresenting the negated expression- Throws:
java.lang.NullPointerException- The given parent cannot benull
-
NotExpressionStateObject
public NotExpressionStateObject(StateObject parent, java.lang.String jpqlFragment)
Creates a newNotExpressionStateObject.- Parameters:
parent- The parent of this state object, which cannot benulljpqlFragment- The portion of the JPQL query that followsNOT, which will be parsed and converted into aStateObject- 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
-
getExpression
public NotExpression 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)
-
getStateObject
public StateObject getStateObject()
Returns theStateObjectrepresenting the negated expression.- Returns:
- The
StateObjectrepresenting the negated expression
-
hasStateObject
public boolean hasStateObject()
Determines whether theStateObjectrepresenting the encapsulated expression is present or not.- Returns:
trueif the encapsulatedStateObjectis notnull;falseotherwise
-
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
-
parse
public void parse(java.lang.String jpqlFragment)
Parses the given JPQL fragment, which represents the negated expression, and creates theStateObject.- Parameters:
jpqlFragment- The portion of the query representing the negated expression
-
setExpression
public void setExpression(NotExpression 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 aNOTexpression
-
setStateObject
public void setStateObject(StateObject stateObject)
Sets the givenStateObjectas the new negated expression.- Parameters:
stateObject- TheStateObjectrepresenting the negated expression
-
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
-
-