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.OrParts consisting of simple Part instances in turn.
Takes a domain class as well to validate that each of the Parts 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
Nested ClassesModifier and TypeClassDescriptionstatic classA part of the parsed source that results from splitting up the resource around Or keywords. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturn the number of maximal results to return or null if not restricted.getParts()getSort()Returns theSortspecification parsed from the source.booleanbooleanReturns whether a count projection shall be applied.booleanisDelete()return true if the createdPartTreeis meant to be used for delete operation.booleanReturns whether we indicate distinct lookup of entities.booleanReturns whether an exists projection shall be applied.booleanReturn true if the createPartTreeis 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, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
PartTree
- Parameters:
source- theStringto parsedomainClass- the domain class to check individual parts against to ensure they refer to a property of the class
-
-
Method Details
-
iterator
- Specified by:
iteratorin interfaceIterable<PartTree.OrPart>
-
getSort
Returns theSortspecification 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 createdPartTreeis meant to be used for delete operation.- Returns:
- Since:
- 1.8
-
isLimiting
public boolean isLimiting()Return true if the createPartTreeis 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
-
getParts
- Returns:
- the iterable
Parts
-
getParts
- Parameters:
type-- Returns:
-
hasPredicate
public boolean hasPredicate()- Returns:
-
toString
-