Package org.springframework.data.domain
Interface ExampleMatcher
public interface ExampleMatcher
Specification for property path matching to use in query by example (QBE). An 
ExampleMatcher can be created
 for a object type. Instances of ExampleMatcher can be either matchingAll() or
 matchingAny() and settings can be tuned with... methods in a fluent style. with... methods
 return a copy of the ExampleMatcher instance with the specified setting. Null-handling defaults to
 ExampleMatcher.NullHandler.IGNORE and case-sensitive ExampleMatcher.StringMatcher.DEFAULT string matching.
 This class is immutable.
- Since:
- 1.12
- Author:
- Christoph Strobl, Mark Paluch, Oliver Gierke, Jens Schauder
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic classA generic property matcher that specifiesstring matchingand case sensitivity.static classPredefined property matchers to create aExampleMatcher.GenericPropertyMatcher.static interfaceCallback to configure a matcher.static enumThe match modes to expose so that clients can find about how to concatenate the predicates.static enumstatic enumNull handling for creating criterion out of anExample.static classDefine specific property handling for a Dot-Path.static classDefine specific property handling for Dot-Paths.static interfaceAllows to transform the property value before it is used in the query.static enumMatch modes for treatment ofStringvalues.
- 
Method SummaryModifier and TypeMethodDescriptionGet the definedExampleMatcher.StringMatcher.Get the match mode of theExampleMatcher.Get the defined null handling.default booleanReturns whether all the predicates of theExampleare supposed to match.default booleanReturns whether it's sufficient that any of the predicates of theExamplematch.booleandefault booleanisIgnoredPath(String path) static ExampleMatchermatching()Create a newExampleMatcherincluding all non-null properties by default matching all predicates derived from the example.static ExampleMatcherCreate a newExampleMatcherincluding all non-null properties by default matching all predicates derived from the example.static ExampleMatcherCreate a newExampleMatcherincluding all non-null properties by default matching any predicate derived from the example.default ExampleMatcherReturns a copy of thisExampleMatcherwith ignoring case sensitivity by default.withIgnoreCase(boolean defaultIgnoreCase) Returns a copy of thisExampleMatcherwithdefaultIgnoreCase.withIgnoreCase(String... propertyPaths) Returns a copy of thisExampleMatcherwith ignore case sensitivity for thepropertyPaths.default ExampleMatcherReturns a copy of thisExampleMatcherwith treatment for null values ofExampleMatcher.NullHandler.IGNORE.withIgnorePaths(String... ignoredPaths) Returns a copy of thisExampleMatcherwith the specifiedpropertyPaths.default ExampleMatcherReturns a copy of thisExampleMatcherwith treatment for null values ofExampleMatcher.NullHandler.INCLUDE.withMatcher(String propertyPath, ExampleMatcher.GenericPropertyMatcher genericPropertyMatcher) Returns a copy of thisExampleMatcherwith the specifiedGenericPropertyMatcherfor thepropertyPath.default ExampleMatcherwithMatcher(String propertyPath, ExampleMatcher.MatcherConfigurer<ExampleMatcher.GenericPropertyMatcher> matcherConfigurer) Returns a copy of thisExampleMatcherwith the specifiedGenericPropertyMatcherfor thepropertyPath.withNullHandler(ExampleMatcher.NullHandler nullHandler) Returns a copy of thisExampleMatcherwith the specifiednullHandler.withStringMatcher(ExampleMatcher.StringMatcher defaultStringMatcher) Returns a copy of thisExampleMatcherwith the specified string matching ofdefaultStringMatcher.withTransformer(String propertyPath, ExampleMatcher.PropertyValueTransformer propertyValueTransformer) Returns a copy of thisExampleMatcherwith the specifiedPropertyValueTransformerfor thepropertyPath.
- 
Method Details- 
matchingCreate a newExampleMatcherincluding all non-null properties by default matching all predicates derived from the example.- Returns:
- new instance of ExampleMatcher.
- See Also:
 
- 
matchingAnyCreate a newExampleMatcherincluding all non-null properties by default matching any predicate derived from the example.- Returns:
- new instance of ExampleMatcher.
 
- 
matchingAllCreate a newExampleMatcherincluding all non-null properties by default matching all predicates derived from the example.- Returns:
- new instance of ExampleMatcher.
 
- 
withIgnorePathsReturns a copy of thisExampleMatcherwith the specifiedpropertyPaths. This instance is immutable and unaffected by this method call.- Parameters:
- ignoredPaths- must not be null and not empty.
- Returns:
- new instance of ExampleMatcher.
 
- 
withStringMatcher@Contract("_ -> new") @CheckReturnValue ExampleMatcher withStringMatcher(ExampleMatcher.StringMatcher defaultStringMatcher) Returns a copy of thisExampleMatcherwith the specified string matching ofdefaultStringMatcher. This instance is immutable and unaffected by this method call.- Parameters:
- defaultStringMatcher- must not be null.
- Returns:
- new instance of ExampleMatcher.
 
- 
withIgnoreCaseReturns a copy of thisExampleMatcherwith ignoring case sensitivity by default. This instance is immutable and unaffected by this method call.- Returns:
- new instance of ExampleMatcher.
 
- 
withIgnoreCaseReturns a copy of thisExampleMatcherwithdefaultIgnoreCase. This instance is immutable and unaffected by this method call.- Parameters:
- defaultIgnoreCase- true to ignore case by default.
- Returns:
- new instance of ExampleMatcher.
 
- 
withMatcher@Contract("_, _ -> new") @CheckReturnValue default ExampleMatcher withMatcher(String propertyPath, ExampleMatcher.MatcherConfigurer<ExampleMatcher.GenericPropertyMatcher> matcherConfigurer) Returns a copy of thisExampleMatcherwith the specifiedGenericPropertyMatcherfor thepropertyPath. This instance is immutable and unaffected by this method call.- Parameters:
- propertyPath- must not be null.
- matcherConfigurer- callback to configure a- ExampleMatcher.GenericPropertyMatcher, must not be null.
- Returns:
- new instance of ExampleMatcher.
 
- 
withMatcher@Contract("_, _ -> new") @CheckReturnValue ExampleMatcher withMatcher(String propertyPath, ExampleMatcher.GenericPropertyMatcher genericPropertyMatcher) Returns a copy of thisExampleMatcherwith the specifiedGenericPropertyMatcherfor thepropertyPath. This instance is immutable and unaffected by this method call.- Parameters:
- propertyPath- must not be null.
- genericPropertyMatcher- callback to configure a- ExampleMatcher.GenericPropertyMatcher, must not be null.
- Returns:
- new instance of ExampleMatcher.
 
- 
withTransformer@Contract("_, _ -> new") @CheckReturnValue ExampleMatcher withTransformer(String propertyPath, ExampleMatcher.PropertyValueTransformer propertyValueTransformer) Returns a copy of thisExampleMatcherwith the specifiedPropertyValueTransformerfor thepropertyPath.- Parameters:
- propertyPath- must not be null.
- propertyValueTransformer- must not be null.
- Returns:
- new instance of ExampleMatcher.
 
- 
withIgnoreCaseReturns a copy of thisExampleMatcherwith ignore case sensitivity for thepropertyPaths. This instance is immutable and unaffected by this method call.- Parameters:
- propertyPaths- must not be null and not empty.
- Returns:
- new instance of ExampleMatcher.
 
- 
withIncludeNullValuesReturns a copy of thisExampleMatcherwith treatment for null values ofExampleMatcher.NullHandler.INCLUDE. This instance is immutable and unaffected by this method call.- Returns:
- new instance of ExampleMatcher.
 
- 
withIgnoreNullValuesReturns a copy of thisExampleMatcherwith treatment for null values ofExampleMatcher.NullHandler.IGNORE. This instance is immutable and unaffected by this method call.- Returns:
- new instance of ExampleMatcher.
 
- 
withNullHandler@Contract("_ -> new") @CheckReturnValue ExampleMatcher withNullHandler(ExampleMatcher.NullHandler nullHandler) Returns a copy of thisExampleMatcherwith the specifiednullHandler. This instance is immutable and unaffected by this method call.- Parameters:
- nullHandler- must not be null.
- Returns:
- new instance of ExampleMatcher.
 
- 
getNullHandlerExampleMatcher.NullHandler getNullHandler()Get the defined null handling.- Returns:
- the defined null handling.
 
- 
getDefaultStringMatcherExampleMatcher.StringMatcher getDefaultStringMatcher()Get the definedExampleMatcher.StringMatcher.- Returns:
- the defined ExampleMatcher.StringMatcher.
 
- 
isIgnoreCaseEnabledboolean isIgnoreCaseEnabled()- Returns:
- true if Stringshould be matched with ignore case option.
 
- 
isIgnoredPath- Parameters:
- path- must not be null.
- Returns:
- return true if path was set to be ignored.
 
- 
getIgnoredPaths- Returns:
- unmodifiable Setof ignored paths.
 
- 
getPropertySpecifiersExampleMatcher.PropertySpecifiers getPropertySpecifiers()- Returns:
- the ExampleMatcher.PropertySpecifierswithin theExampleMatcher.
 
- 
isAllMatchingdefault boolean isAllMatching()Returns whether all the predicates of theExampleare supposed to match. If false is returned, it's sufficient if any of the predicates derived from theExamplematch.- Returns:
- whether all the predicates of the Exampleare supposed to match or any of them is sufficient.
 
- 
isAnyMatchingdefault boolean isAnyMatching()Returns whether it's sufficient that any of the predicates of theExamplematch. If false is returned, all predicates derived from the example need to match to produce results.- Returns:
- whether it's sufficient that any of the predicates of the Examplematch or all need to match.
 
- 
getMatchModeExampleMatcher.MatchMode getMatchMode()Get the match mode of theExampleMatcher.- Returns:
- never null.
- Since:
- 2.0
 
 
-