Class Collation
java.lang.Object
org.springframework.data.mongodb.core.query.Collation
Central abstraction for MongoDB collation support.
Allows fluent creation of a collation
NOTE: Please keep in mind that queries will only make use of an index with collation settings if the query itself specifies the same collation.
Allows fluent creation of a collation
Document that can be used for creating collections invalid input: '&' indexes as well as
querying data.
NOTE: Please keep in mind that queries will only make use of an index with collation settings if the query itself specifies the same collation.
- Since:
- 2.0
- Author:
- Christoph Strobl, Mark Paluch, Jens Schauder
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classICU locale abstraction for usage with MongoDBCollation.static interfaceAbstraction for the ICU Comparison Levels.static classPrimary-strengthCollation.ICUComparisonLevel.static classSecondary-strengthCollation.ICUComparisonLevel.static classTertiary-strengthCollation.ICUComparisonLevel. -
Method Summary
Modifier and TypeMethodDescriptionSet the Field that determines whether collation should consider whitespace and punctuation as base characters for purposes of comparison.alternate(Collation.Alternate alternate) Set the Field that determines whether collation should consider whitespace and punctuation as base characters for purposes of comparison.Sort string with diacritics sort from back of the string.backwards(boolean backwards) Set the flag that determines whether strings with diacritics sort from back of the string.Set the flag that determines sort order of case differences during tertiary level comparisons.caseFirst(Collation.CaseFirst sort) Set the flag that determines sort order of case differences during tertiary level comparisons.caseLevel(boolean caseLevel) Set whether to includecaseLevelcomparison.booleanDo not sort string with diacritics sort from back of the string.static Collationfrom(org.bson.Document source) Create newCollationfrom values inDocument.inthashCode()<R> @Nullable RmaxVariable(String maxVariable) Set the field that determines up to which characters are considered ignorable when alternate isshifted.normalization(boolean normalization) Set the flag that determines whether to check if text require normalization and to perform normalization.Disable text normalization.Enable text normalization.numericOrdering(boolean flag) Set the flag that determines whether to compare numeric strings as numbers or as strings.Treat numeric strings as string for comparison.Treat numeric strings as numbers for comparison.static CollationCreate newCollationwith locale set to the given ICU language.static Collationstatic Collationof(Collation.CollationLocale locale) Create newCollationwith locale set to the givenCollation.CollationLocale.static CollationParse the givencollationstring into aCollation.static Collationsimple()Create aCollationusing simple binary comparison.strength(int strength) Set the level of comparison to perform.strength(Collation.ComparisonLevel comparisonLevel) Set the level of comparison to perform.org.bson.DocumentGet theDocumentrepresentation of theCollation.@Nullable com.mongodb.client.model.CollationGet theCollationrepresentation of theCollation.toString()
-
Method Details
-
simple
-
of
- Parameters:
locale- must not be null.- Returns:
- new instance of
Collation.
-
of
-
of
Create newCollationwith locale set to the givenCollation.CollationLocale.- Parameters:
locale- must not be null.- Returns:
- new instance of
Collation.
-
parse
Parse the givencollationstring into aCollation.- Parameters:
collation- the collation to parse. Can be a simple string likeen_USor aparsabledocument like{ 'locale' : '?0' }.- Returns:
- never null.
- Throws:
IllegalArgumentException- if collation is null.- Since:
- 2.2
-
from
-
strength
-
strength
Set the level of comparison to perform.- Parameters:
comparisonLevel- must not be null.- Returns:
- new
Collation
-
caseLevel
-
caseFirst
-
caseFirst
Set the flag that determines sort order of case differences during tertiary level comparisons.- Parameters:
sort- must not be null.- Returns:
- new instance of
Collation.
-
numericOrderingEnabled
-
numericOrderingDisabled
-
numericOrdering
-
alternate
-
alternate
Set the Field that determines whether collation should consider whitespace and punctuation as base characters for purposes of comparison.- Parameters:
alternate- must not be null.- Returns:
- new
Collation.
-
backwardDiacriticSort
-
forwardDiacriticSort
-
backwards
-
normalizationEnabled
-
normalizationDisabled
-
normalization
-
maxVariable
-
toDocument
-
toMongoCollation
-
map
-
toString
-
equals
-
hashCode
-