com.twitter.twittertext

## Class TwitterTextConfiguration

- java.lang.Object
- - com.twitter.twittertext.TwitterTextConfiguration

-     public class TwitterTextConfiguration
      extends java.lang.Object

  A class that represents the different configurations used by `TwitterTextParser` to parse a tweet.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `TwitterTextConfiguration.TwitterTextWeightedRange`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TwitterTextConfiguration()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static TwitterTextConfiguration` | `configurationFromJson(java.lang.String json, boolean isResource)` Create a `TwitterTextConfiguration` object from JSON The JSON can have the following properties version (required, integer, min value 0) maxWeightedTweetLength (required, integer, min value 0) scale (required, integer, min value 1) defaultWeight (required, integer, min value 0) transformedURLLength (integer, min value 0) ranges (array of range items) A range item has the following properties: start (required, integer, min value 0) end (required, integer, min value 0) weight (required, integer, min value 0)
    `boolean` | `equals(java.lang.Object o)`
    `int` | `getDefaultWeight()` Get the default weight.
    `boolean` | `getEmojiParsingEnabled()` Get whether emoji parsing is enabled.
    `int` | `getMaxWeightedTweetLength()` Get the maximum weighted length in the config.
    `java.util.List<TwitterTextConfiguration.TwitterTextWeightedRange>` | `getRanges()` Get an array of range items that describe ranges of Unicode code points and the weight to apply to each code point.
    `int` | `getScale()` Get the scale.
    `int` | `getTransformedURLLength()` In previous versions of twitter-text, which was the "shortened URL length." Differentiating between the http and https shortened length for URLs has been deprecated (https is used for all t.co URLs).
    `int` | `getVersion()` Get the current version.
    `int` | `hashCode()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TwitterTextConfiguration

          public TwitterTextConfiguration()

  - ### Method Detail

    - #### configurationFromJson

          public static TwitterTextConfiguration configurationFromJson(java.lang.String json,
                                                                       boolean isResource)

      Create a `TwitterTextConfiguration` object from JSON The JSON can have the following properties version (required, integer, min value 0) maxWeightedTweetLength (required, integer, min value 0) scale (required, integer, min value 1) defaultWeight (required, integer, min value 0) transformedURLLength (integer, min value 0) ranges (array of range items) A range item has the following properties: start (required, integer, min value 0) end (required, integer, min value 0) weight (required, integer, min value 0)
      Parameters:
        `json` - The configuration string or file name in the config directory
        `isResource` - boolean indicating if the json refers to a file name for the configuration.
      Returns:
        a `TwitterTextConfiguration` object that provides all the configuration values.

    - #### getVersion

          public int getVersion()

      Get the current version. This is an integer that will monotonically increase in future releases. The legacy version of the string is version 1; weighted code point ranges and 280-character “long” tweets are supported in version 2.
      Returns:
        The version for the configuration string.

    - #### getMaxWeightedTweetLength

          public int getMaxWeightedTweetLength()

      Get the maximum weighted length in the config. Legacy v1 tweets had a maximum weighted length of 140 and all characters were weighted the same. In the new configuration format, this is represented as a `maxWeightedTweetLength` of 140 and a `defaultWeight` of 1 for all code points.
      Returns:
        The maximum length of the tweet, weighted.

    - #### getScale

          public int getScale()

      Get the scale.
      Returns:
        The Tweet length is the (weighted length / scale).

    - #### getDefaultWeight

          public int getDefaultWeight()

      Get the default weight. This is overridden in one or more range items.
      Returns:
        The default weight applied to all code points.

    - #### getEmojiParsingEnabled

          public boolean getEmojiParsingEnabled()

      Get whether emoji parsing is enabled.
      Returns:
        true if emoji parsing is enabled, otherwise false.

    - #### getTransformedURLLength

          public int getTransformedURLLength()

      In previous versions of twitter-text, which was the "shortened URL length." Differentiating between the http and https shortened length for URLs has been deprecated (https is used for all t.co URLs). The default value is 23.
      Returns:
        The length counted for URLs against the total weight of the Tweet.

    - #### getRanges

          public java.util.List<TwitterTextConfiguration.TwitterTextWeightedRange> getRanges()

      Get an array of range items that describe ranges of Unicode code points and the weight to apply to each code point. Each range is defined by its start, end, and weight. Surrogate pairs have a length that is equivalent to the length of the first code unit in the surrogate pair. Note that certain graphemes are the result of joining code points together, such as by a zero-width joiner; unlike a surrogate pair, the length of such a grapheme will be the sum of the weighted length of all included code points.
      Returns:
        An array of range items.

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### equals

          public boolean equals(java.lang.Object o)

      Overrides:
        `equals` in class `java.lang.Object`