Class PartTree
java.lang.Object
org.springframework.data.repository.query.parser.PartTree
- All Implemented Interfaces:
Iterable<PartTree.OrPart>
,Supplier<Stream<PartTree.OrPart>>
,Streamable<PartTree.OrPart>
Class to parse a
String
into a tree or PartTree.OrPart
s consisting of simple Part
instances in turn.
Takes a domain class as well to validate that each of the Part
s are referring to a property of the domain
class. The PartTree
can then be used to build queries based on its API instead of parsing the method name for
each query execution.- Author:
- Oliver Gierke, Thomas Darimont, Christoph Strobl, Mark Paluch, Shaun Chyxion, Johannes Englmeier
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A part of the parsed source that results from splitting up the resource around Or keywords. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturn the number of maximal results to return or null if not restricted.getParts()
Return the number of maximal results to return orLimit.unlimited()
if not restricted.getSort()
Returns theSort
specification parsed from the source.boolean
boolean
Returns whether a count projection shall be applied.boolean
isDelete()
return true if the createdPartTree
is meant to be used for delete operation.boolean
Returns whether we indicate distinct lookup of entities.boolean
Returns whether an exists projection shall be applied.boolean
Return true if the createPartTree
is meant to be used for a query with limited maximal results.iterator()
toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
PartTree
- Parameters:
source
- theString
to parsedomainClass
- the domain class to check individual parts against to ensure they refer to a property of the class
-
-
Method Details
-
iterator
- Specified by:
iterator
in interfaceIterable<PartTree.OrPart>
-
getSort
Returns theSort
specification parsed from the source.- Returns:
- never null.
-
isDistinct
public boolean isDistinct()Returns whether we indicate distinct lookup of entities.- Returns:
- true if distinct
-
isCountProjection
public boolean isCountProjection()Returns whether a count projection shall be applied.- Returns:
-
isExistsProjection
public boolean isExistsProjection()Returns whether an exists projection shall be applied.- Returns:
- Since:
- 1.13
-
isDelete
public boolean isDelete()return true if the createdPartTree
is meant to be used for delete operation.- Returns:
- Since:
- 1.8
-
isLimiting
public boolean isLimiting()Return true if the createPartTree
is meant to be used for a query with limited maximal results.- Returns:
- Since:
- 1.9
-
getMaxResults
Return the number of maximal results to return or null if not restricted.- Returns:
- null if not restricted.
- Since:
- 1.9
-
getResultLimit
Return the number of maximal results to return orLimit.unlimited()
if not restricted.- Returns:
- null if not restricted.
- Since:
- 3.2
-
getParts
- Returns:
- the iterable
Part
s
-
getParts
- Parameters:
type
-- Returns:
-
hasPredicate
public boolean hasPredicate()- Returns:
-
toString
-