Class Query

java.lang.Object
org.neo4j.driver.Query

@Immutable public class Query extends Object
The components of a Cypher query, containing the query text and parameter map.
Since:
1.0
See Also:
  • Constructor Details

    • Query

      public Query(String text, Value parameters)
      Create a new query.
      Parameters:
      text - the query text
      parameters - the parameter map
    • Query

      public Query(String text, Map<String,Object> parameters)
      Create a new query.
      Parameters:
      text - the query text
      parameters - the parameter map
    • Query

      public Query(String text)
      Create a new query.
      Parameters:
      text - the query text
  • Method Details

    • text

      public String text()
      Returns:
      the query text
    • parameters

      public Value parameters()
      Returns:
      the parameter map
    • withText

      public Query withText(String newText)
      Parameters:
      newText - the new query text
      Returns:
      a new Query object with updated text
    • withParameters

      public Query withParameters(Value newParameters)
      Parameters:
      newParameters - the new parameter map
      Returns:
      a new Query object with updated parameters
    • withParameters

      public Query withParameters(Map<String,Object> newParameters)
      Parameters:
      newParameters - the new parameter map
      Returns:
      a new Query object with updated parameters
    • withUpdatedParameters

      public Query withUpdatedParameters(Value updates)
      Create a new query with new parameters derived by updating this' query's parameters using the given updates.

      Every update key that points to a null value will be removed from the new query's parameters. All other entries will just replace any existing parameter in the new query.

      Parameters:
      updates - describing how to update the parameters
      Returns:
      a new query with updated parameters
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object