public class CollationOptions extends Object
| Modifier and Type | Field and Description |
|---|---|
static Alternate |
DEFAULT_ALTERNATE |
static Boolean |
DEFAULT_BACKWARDS |
static CaseFirst |
DEFAULT_CASE_FIRST |
static Boolean |
DEFAULT_CASE_LEVEL |
static MaxVariable |
DEFAULT_MAX_VARIABLE |
static Boolean |
DEFAULT_NORMALIZATION |
static Boolean |
DEFAULT_NUMERIC_ORDERING |
static Integer |
DEFAULT_STRENGTH |
| 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) |
String |
getAlternate()
Get alternate
|
CaseFirst |
getCaseFirst()
Get case first
|
String |
getLocale()
Get the locale
|
MaxVariable |
getMaxVariable()
Get max variable
|
int |
getStrength()
Get strength level
|
int |
hashCode() |
boolean |
isBackwards()
Get backwards
|
boolean |
isCaseLevel()
Get case level
|
boolean |
isNormalization() |
boolean |
isNumericOrdering()
Get numeric ordering
|
CollationOptions |
setAlternate(String alternate)
Optional.
|
CollationOptions |
setBackwards(boolean backwards)
Optional.
|
CollationOptions |
setCaseFirst(CaseFirst caseFirst)
Optional.
|
CollationOptions |
setCaseLevel(boolean caseLevel)
Optional.
|
CollationOptions |
setLocale(String locale)
The ICU locale.
|
CollationOptions |
setMaxVariable(MaxVariable maxVariable)
Optional.
|
CollationOptions |
setNormalization(boolean normalization)
Optional.
|
CollationOptions |
setNumericOrdering(boolean numericOrdering)
Optional.
|
CollationOptions |
setStrength(int strength)
Optional.
|
JsonObject |
toJson()
Convert to JSON
|
com.mongodb.client.model.Collation |
toMongoDriverObject() |
public static final Boolean DEFAULT_CASE_LEVEL
public static final CaseFirst DEFAULT_CASE_FIRST
public static final Alternate DEFAULT_ALTERNATE
public static final Integer DEFAULT_STRENGTH
public static final Boolean DEFAULT_NUMERIC_ORDERING
public static final Boolean DEFAULT_BACKWARDS
public static final Boolean DEFAULT_NORMALIZATION
public static final MaxVariable DEFAULT_MAX_VARIABLE
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)
To specify simple binary comparison, specify locale value of "simple".
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 CaseFirst getCaseFirst()
public CollationOptions setCaseFirst(CaseFirst 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 int getStrength()
public CollationOptions setStrength(int 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 String getAlternate()
public CollationOptions setAlternate(String 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 MaxVariable getMaxVariable()
public CollationOptions setMaxVariable(MaxVariable 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 © 2021 Eclipse. All rights reserved.