public class CollationOptions extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_LOCALE
Default locale :
simple |
Constructor and Description |
---|
CollationOptions()
Default constructor for setting
|
CollationOptions(CollationOptions options)
Copy constructor
|
CollationOptions(JsonObject json)
Constructing from a JsonObject with provided attributes
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
com.mongodb.client.model.CollationAlternate |
getAlternate()
Get alternate
|
com.mongodb.client.model.CollationCaseFirst |
getCaseFirst()
Get case first
|
String |
getLocale()
Get the locale
|
com.mongodb.client.model.CollationMaxVariable |
getMaxVariable()
Get max variable
|
com.mongodb.client.model.CollationStrength |
getStrength()
Get strength level
|
int |
hashCode() |
Boolean |
isBackwards()
Get backwards
|
Boolean |
isCaseLevel()
Get case level
|
Boolean |
isNormalization() |
Boolean |
isNumericOrdering()
Get numeric ordering
|
CollationOptions |
setAlternate(com.mongodb.client.model.CollationAlternate alternate)
Optional.
|
CollationOptions |
setBackwards(Boolean backwards)
Optional.
|
CollationOptions |
setCaseFirst(com.mongodb.client.model.CollationCaseFirst caseFirst)
Optional.
|
CollationOptions |
setCaseLevel(Boolean caseLevel)
Optional.
|
CollationOptions |
setLocale(String locale)
The ICU locale.
|
CollationOptions |
setMaxVariable(com.mongodb.client.model.CollationMaxVariable maxVariable)
Optional.
|
CollationOptions |
setNormalization(Boolean normalization)
Optional.
|
CollationOptions |
setNumericOrdering(Boolean numericOrdering)
Optional.
|
CollationOptions |
setStrength(com.mongodb.client.model.CollationStrength strength)
Optional.
|
JsonObject |
toJson()
Convert to JSON
|
com.mongodb.client.model.Collation |
toMongoDriverObject() |
String |
toString() |
public static final String DEFAULT_LOCALE
simple
public CollationOptions()
public CollationOptions(CollationOptions options)
options
- public CollationOptions(JsonObject json)
json
- containing collation optionspublic com.mongodb.client.model.Collation toMongoDriverObject()
public Boolean isNormalization()
public CollationOptions setNormalization(Boolean normalization)
If true, check if fully normalized and perform normalization to compare text. If false, does not check.
The default value is false.
normalization
- public JsonObject toJson()
public String getLocale()
public CollationOptions setLocale(String locale)
The default value is simple
which specifies simple binary comparison.
locale
- stringpublic Boolean isCaseLevel()
public CollationOptions setCaseLevel(Boolean caseLevel)
If true, include case comparison; i.e.
When used with strength:1, collation compares base characters and case. When used with strength:2, collation compares base characters, diacritics (and possible other secondary differences) and case. If false, do not include case comparison at level 1 or 2. The default is false.
caseLevel
- public com.mongodb.client.model.CollationCaseFirst getCaseFirst()
public CollationOptions setCaseFirst(com.mongodb.client.model.CollationCaseFirst caseFirst)
Possible values are: "upper" Uppercase sorts before lowercase. "lower" Lowercase sorts before uppercase. "off" Default value. Similar to "lower" with slight differences. See Collation customization for details of differences.
caseFirst
- one of UPPER, LOWER, OFFpublic com.mongodb.client.model.CollationStrength getStrength()
public CollationOptions setStrength(com.mongodb.client.model.CollationStrength strength)
Value Description 1 Primary level of comparison. Collation performs comparisons of the base characters only, ignoring other differences such as diacritics and case. 2 Secondary level of comparison. Collation performs comparisons up to secondary differences, such as diacritics. That is, collation performs comparisons of base characters (primary differences) and diacritics (secondary differences). Differences between base characters takes precedence over secondary differences. 3 Tertiary level of comparison. Collation performs comparisons up to tertiary differences, such as case and letter variants. That is, collation performs comparisons of base characters (primary differences), diacritics (secondary differences), and case and variants (tertiary differences). Differences between base characters takes precedence over secondary differences, which takes precedence over tertiary differences. This is the default level.
4 Quaternary Level. Limited for specific use case to consider punctuation when levels 1-3 ignore punctuation or for processing Japanese text. 5 Identical Level. Limited for specific use case of tie breaker.
strength
- levelpublic Boolean isNumericOrdering()
public CollationOptions setNumericOrdering(Boolean numericOrdering)
If true, compare as numbers; i.e. "10" is greater than "2". If false, compare as strings; i.e. "10" is less than "2".
Default is false.
numericOrdering
- valuepublic com.mongodb.client.model.CollationAlternate getAlternate()
public CollationOptions setAlternate(com.mongodb.client.model.CollationAlternate alternate)
Possible values are: "non-ignorable" Whitespace and punctuation are considered base characters. "shifted" Whitespace and punctuation are not considered base characters and are only distinguished at strength levels greater than 3. See ICU Collation: Comparison Levels for more information.
Default is "non-ignorable".
alternate
- either of NON_IGNORABLE, SHIFTEDpublic com.mongodb.client.model.CollationMaxVariable getMaxVariable()
public CollationOptions setMaxVariable(com.mongodb.client.model.CollationMaxVariable maxVariable)
Possible values are: "punct" Both whitespace and punctuation are "ignorable", i.e. not considered base characters. "space" Whitespace are "ignorable", i.e. not considered base characters.
maxVariable
- either of PUNCT, SPACEpublic Boolean isBackwards()
public CollationOptions setBackwards(Boolean backwards)
If true, compare from back to front. If false, compare from front to back.
The default value is false.
backwards
- Copyright © 2024 Eclipse. All rights reserved.