Class CollationOptions

    • Constructor Detail

      • CollationOptions

        public CollationOptions()
        Default constructor for setting
      • CollationOptions

        public CollationOptions​(CollationOptions options)
        Copy constructor
        Parameters:
        options -
      • CollationOptions

        public CollationOptions​(JsonObject json)
        Constructing from a JsonObject with provided attributes
        Parameters:
        json - containing collation options
    • Method Detail

      • toMongoDriverObject

        public com.mongodb.client.model.Collation toMongoDriverObject()
      • isNormalization

        public Boolean isNormalization()
      • setNormalization

        public CollationOptions setNormalization​(Boolean normalization)
        Optional. Flag that determines whether to check if text require normalization and to perform normalization. Generally, majority of text does not require this normalization processing.

        If true, check if fully normalized and perform normalization to compare text. If false, does not check.

        The default value is false.

        Parameters:
        normalization -
        Returns:
        CollationOption
        See Also:
        TOC Normalization for details.
      • toJson

        public JsonObject toJson()
        Convert to JSON
        Returns:
        CollationOption as JSON
      • getLocale

        public String getLocale()
        Get the locale
        Returns:
        locale string
      • isCaseLevel

        public Boolean isCaseLevel()
        Get case level
        Returns:
        caseLevel
      • setCaseLevel

        public CollationOptions setCaseLevel​(Boolean caseLevel)
        Optional. Flag that determines whether to include case comparison at strength level 1 or 2.

        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.

        Parameters:
        caseLevel -
        Returns:
        CollationOption
        See Also:
        ICU Collation: Case Level
      • getCaseFirst

        public com.mongodb.client.model.CollationCaseFirst getCaseFirst()
        Get case first
        Returns:
        case first
      • setCaseFirst

        public CollationOptions setCaseFirst​(com.mongodb.client.model.CollationCaseFirst caseFirst)
        Optional. A field that determines sort order of case differences during tertiary level comparisons.

        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.

        Parameters:
        caseFirst - one of UPPER, LOWER, OFF
        Returns:
        CollationOption
        See Also:
        Collation customization
      • getStrength

        public com.mongodb.client.model.CollationStrength getStrength()
        Get strength level
        Returns:
        strength level
      • setStrength

        public CollationOptions setStrength​(com.mongodb.client.model.CollationStrength strength)
        Optional. The level of comparison to perform. Corresponds to ICU Comparison Levels. Possible values are:

        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.

        Parameters:
        strength - level
        Returns:
        CollationOption
        See Also:
        ICU Collation: Comparison Levels
      • isNumericOrdering

        public Boolean isNumericOrdering()
        Get numeric ordering
        Returns:
        Numeric ordering
      • setNumericOrdering

        public CollationOptions setNumericOrdering​(Boolean numericOrdering)
        Optional. Flag that determines whether to compare numeric strings as numbers or as strings.

        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.

        Parameters:
        numericOrdering - value
        Returns:
        CollationOption
      • getAlternate

        public com.mongodb.client.model.CollationAlternate getAlternate()
        Get alternate
        Returns:
        alternate
      • setAlternate

        public CollationOptions setAlternate​(com.mongodb.client.model.CollationAlternate alternate)
        Optional. Field that determines whether collation should consider whitespace and punctuation as base characters for purposes of comparison.

        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".

        Parameters:
        alternate - either of NON_IGNORABLE, SHIFTED
        Returns:
        CollationOption
        See Also:
        ICU Collation: Comparison Levels
      • getMaxVariable

        public com.mongodb.client.model.CollationMaxVariable getMaxVariable()
        Get max variable
        Returns:
        max variable
      • setMaxVariable

        public CollationOptions setMaxVariable​(com.mongodb.client.model.CollationMaxVariable maxVariable)
        Optional. Field that determines up to which characters are considered ignorable when alternate: "shifted". Has no effect if alternate: "non-ignorable"

        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.

        Parameters:
        maxVariable - either of PUNCT, SPACE
        Returns:
        CollationOption
      • isBackwards

        public Boolean isBackwards()
        Get backwards
        Returns:
        backwards
      • setBackwards

        public CollationOptions setBackwards​(Boolean backwards)
        Optional. Flag that determines whether strings with diacritics sort from back of the string, such as with some French dictionary ordering.

        If true, compare from back to front. If false, compare from front to back.

        The default value is false.

        Parameters:
        backwards -
        Returns:
        CollationOption
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object