Class AbstractIdentificationVariableDeclarationStateObject

All Implemented Interfaces:
ListHolderStateObject<JoinStateObject>, StateObject, VariableDeclarationStateObject
Direct Known Subclasses:
DerivedPathIdentificationVariableDeclarationStateObject, IdentificationVariableDeclarationStateObject

public abstract class AbstractIdentificationVariableDeclarationStateObject extends AbstractListHolderStateObject<JoinStateObject> implements VariableDeclarationStateObject
Since:
2.4
Version:
2.5
  • Field Details

  • Constructor Details

    • AbstractIdentificationVariableDeclarationStateObject

      protected AbstractIdentificationVariableDeclarationStateObject(AbstractFromClauseStateObject parent)
      Creates a new AbstractIdentificationVariableDeclarationStateObject.
      Parameters:
      parent - The parent of this state object, which cannot be null
      Throws:
      NullPointerException - The given parent cannot be null
    • AbstractIdentificationVariableDeclarationStateObject

      protected AbstractIdentificationVariableDeclarationStateObject(AbstractFromClauseStateObject parent, String root, String identificationVariable)
      Creates a new AbstractIdentificationVariableDeclarationStateObject.
      Parameters:
      parent - The parent of this state object, which cannot be null
      root - The "root" object
      identificationVariable - The identification variable defining the given path
      Throws:
      NullPointerException - The given parent cannot be null
  • Method Details

    • addChildren

      protected void addChildren(List<StateObject> children)
      Description copied from class: AbstractStateObject
      Adds the children of this StateObject to the given list.
      Overrides:
      addChildren in class AbstractListHolderStateObject<JoinStateObject>
      Parameters:
      children - The list used to store the children
    • addInnerJoin

      public JoinStateObject addInnerJoin(String path, String identificationVariable)
      Adds a new INNER JOIN expression to this declaration.
      Parameters:
      path - The join association path expression
      identificationVariable - The new variable defining the join association path
      Returns:
      A new JoinStateObject
    • addJoin

      public JoinStateObject addJoin(String joinType)
      Adds a new JOIN expression to this declaration.
      Parameters:
      joinType - One of the joining types: LEFT JOIN, LEFT OUTER JOIN, INNER JOIN or JOIN
      Returns:
      A new JoinStateObject
    • addJoin

      public JoinStateObject addJoin(String joinType, ListIterator<String> paths, String identificationVariable)
      Adds a new JOIN expression to this declaration.
      Parameters:
      joinType - One of the joining types: LEFT JOIN, LEFT OUTER JOIN, INNER JOIN or JOIN
      paths - The join association path expression
      identificationVariable - The new variable defining the join association path
      Returns:
      A new JoinStateObject
    • addJoin

      public JoinStateObject addJoin(String path, String identificationVariable)
      Adds a new JOIN expression to this declaration.
      Parameters:
      path - The join association path expression
      identificationVariable - The new variable defining the join association path
      Returns:
      A new JoinStateObject
    • addJoin

      public JoinStateObject addJoin(String joinType, String path, String identificationVariable)
      Adds a new JOIN expression to this declaration.
      Parameters:
      joinType - One of the joining types: LEFT JOIN, LEFT OUTER JOIN, INNER JOIN or JOIN
      path - The join association path expression
      identificationVariable - The new variable defining the join association path
      Returns:
      A new JoinStateObject
    • addLeftJoin

      public JoinStateObject addLeftJoin(String path, String identificationVariable)
      Adds a new LEFT JOIN expression to this declaration.
      Parameters:
      path - The join association path expression
      identificationVariable - The new variable defining the join association path
      Returns:
      A new JoinStateObject
    • addLeftOuterJoin

      public JoinStateObject addLeftOuterJoin(String path, String identificationVariable)
      Adds a new LEFT OUTER JOIN expression to this declaration.
      Parameters:
      path - The join association path expression
      identificationVariable - The new variable defining the join association path
      Returns:
      A new JoinStateObject
    • buildRangeVariableDeclarationStateObject

      protected abstract AbstractRangeVariableDeclarationStateObject buildRangeVariableDeclarationStateObject()
      Creates
    • getExpression

      public IdentificationVariableDeclaration getExpression()
      Description copied from interface: StateObject
      Returns the actual parsed object if this StateObject representation of the JPQL query was created by parsing an existing JPQL query.
      Specified by:
      getExpression in interface StateObject
      Overrides:
      getExpression in class AbstractStateObject
      Returns:
      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)
    • getIdentificationVariable

      public String getIdentificationVariable()
      Returns the identification variable identifying the "root".
      Returns:
      A case insensitive unique identifier declaring the "root" of the declaration
    • getIdentificationVariableStateObject

      public IdentificationVariableStateObject getIdentificationVariableStateObject()
      Returns the IdentificationVariableStateObject holding onto the identification variable.
      Returns:
      The IdentificationVariableStateObject, which is never null
    • getParent

      public AbstractFromClauseStateObject getParent()
      Description copied from interface: StateObject
      Returns the parent of this StateObject.
      Specified by:
      getParent in interface StateObject
      Overrides:
      getParent in class AbstractStateObject
      Returns:
      Returns the parent of this StateObject, which is null only when this is the root of the hierarchy
    • getRangeVariableDeclaration

      public AbstractRangeVariableDeclarationStateObject getRangeVariableDeclaration()
      Returns the StateObject representing the range variable declaration portion.
      Returns:
      The concrete instance
    • getRootPath

      public String getRootPath()
      Returns the "root" object for objects which may not be reachable by navigation.
      Returns:
      The "root" object
    • getRootStateObject

      public StateObject getRootStateObject()
      Returns the StateObject representing the "root" for objects which may not be reachable by navigation.
      Returns:
      The StateObject representing one of the possible valid "root"
    • identificationVariables

      public ListIterable<IdentificationVariableStateObject> identificationVariables()
      Description copied from interface: VariableDeclarationStateObject
      Returns the IdentificationVariableStateObject that are used by this state object. It is possible more than one declaration exists, like a range variable declaration has also joins and join fetches.
      Specified by:
      identificationVariables in interface VariableDeclarationStateObject
      Returns:
      The list of IdentificationVariableStateObject
    • initialize

      protected void initialize()
      Description copied from class: AbstractStateObject
      Initializes this state object.
      Overrides:
      initialize in class AbstractListHolderStateObject<JoinStateObject>
    • isEquivalent

      public boolean isEquivalent(StateObject stateObject)
      Description copied from interface: StateObject
      Determines whether the given StateObject is equivalent to this one, i.e. the information of both StateObject is the same.
      Specified by:
      isEquivalent in interface StateObject
      Overrides:
      isEquivalent in class AbstractStateObject
      Parameters:
      stateObject - The StateObject to compare its content to this one
      Returns:
      true if both object are equivalent; false otherwise
    • listName

      protected String listName()
      Description copied from class: AbstractListHolderStateObject
      Returns the name that is uniquely identifying the list.
      Specified by:
      listName in class AbstractListHolderStateObject<JoinStateObject>
      Returns:
      The unique name identifying the list
    • parseJoin

      public void parseJoin(String jpqlFragment)
      Parses the given JPQL fragment that should contain a single JOIN expression.
      Parameters:
      jpqlFragment - The portion representing a JOIN expression
    • setExpression

      public void setExpression(IdentificationVariableDeclaration 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 - The parsed object representing an identification variable declaration
    • setIdentificationVariable

      public void setIdentificationVariable(String identificationVariable)
      Sets the new identification variable that will range over the "root".
      Parameters:
      identificationVariable - The new identification variable
    • setRootPath

      public void setRootPath(String root)
      Sets the "root" object for objects which may not be reachable by navigation.
      Parameters:
      root - The "root" object
    • toTextInternal

      protected void toTextInternal(Appendable writer) throws IOException
      Description copied from class: AbstractStateObject
      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.
      Specified by:
      toTextInternal in class AbstractStateObject
      Parameters:
      writer - The writer used to print out the string representation
      Throws:
      IOException - This should never happens, it is only required because Appendable is used instead of any concrete class