public class TwitterTextConfiguration extends Object
TwitterTextParser
to parse a tweet.| Modifier and Type | Class and Description |
|---|---|
static class |
TwitterTextConfiguration.TwitterTextWeightedRange |
| Constructor and Description |
|---|
TwitterTextConfiguration() |
| Modifier and Type | Method and Description |
|---|---|
static TwitterTextConfiguration |
configurationFromJson(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(Object o) |
int |
getDefaultWeight()
Get the default weight.
|
int |
getMaxWeightedTweetLength()
Get the maximum weighted length in the config.
|
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() |
@Nonnull public static TwitterTextConfiguration configurationFromJson(@Nonnull String json, boolean isResource)
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)json - The configuration string or file name in the config directoryisResource - boolean indicating if the json refers to a file name for the configuration.TwitterTextConfiguration object that provides all the configuration values.public int getVersion()
public int getMaxWeightedTweetLength()
maxWeightedTweetLength of 140
and a defaultWeight of 1 for all code points.public int getScale()
public int getDefaultWeight()
public int getTransformedURLLength()
@Nonnull public List<TwitterTextConfiguration.TwitterTextWeightedRange> getRanges()
Copyright © 2018. All rights reserved.