Package com.sportradar.utils
Class SdkHelper
java.lang.Object
com.sportradar.utils.SdkHelper
An utility class that contains various methods which perform common language tasks
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe regex pattern to extract error message from failed API requestsstatic final StringThe regex pattern to extract response message from failed API requestsstatic final org.slf4j.Loggerstatic Stringstatic final Stringstatic final Stringstatic intstatic Stringstatic String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancheckCauseReason(Throwable cause, String message) static LocalecheckConfigurationLocales(Locale defaultLocale, Set<Locale> supportedLocales) static DatecombineDateAndTime(Date date, Date time) static StringdateToString(Date date) static StringdictionaryToString(Map<String, String> dict) static StringdoubleToStringWithSign(double value) static StringextractHttpResponseMessage(String responseContent) Filters out the translated data not neededfindMissingLocales(Collection<Locale> have, List<Locale> want) Calculates and returns the missing locales within the providedListstatic StringgetAbbreviationFromName(String input, int length) Get the abbreviation from the input stringstatic longgetTimeDifferenceInSeconds(Date d1, Date d2) static StringgetUuid(int size) Get the specified size of UUIDstatic Stringstatic StringintegerSetToString(Set<Integer> set) static booleanstatic booleanisDataNotFound(Throwable e, int counter) static StringlocaleListToString(List<Locale> locales) static StringObfuscate the input stringstatic Map<Urn,ReferenceIdCi> parseCompetitorsReferences(List<com.sportradar.uf.sportsapi.datamodel.SapiTeam> competitors, Map<Urn, ReferenceIdCi> currentCompetitorsReferences) Get competitor reference from a list of competitors Note: reference must be checked and updated, since it is not sure that references on summary are the same as on fixturestatic Map<Urn,ReferenceIdCi> parseTeamCompetitorsReferences(List<com.sportradar.uf.sportsapi.datamodel.SapiTeamCompetitor> competitors, Map<Urn, ReferenceIdCi> currentCompetitorsReferences) Get competitor reference from a list of competitors Note: reference must be checked and updated, since it is not sure that references on summary are the same as on fixturestatic StringspecifierKeyListToString(List<Specifier> specifiers) static StringspecifierListToString(List<Specifier> specifiers) static booleanstringIsNullOrEmpty(String input) Check is string is null or emptystatic StringstringSetToString(Set<String> set) static Datestatic DatetoDate(XMLGregorianCalendar gregorianCalendar)
-
Field Details
-
ExecutionLog
public static final org.slf4j.Logger ExecutionLog -
MarketDescriptionMinFetchInterval
public static int MarketDescriptionMinFetchInterval -
InVariantMarketListCache
-
VariantMarketSingleCache
-
VariantMarketListCache
-
ISO_8601_24H_FORMAT
- See Also:
-
ISO_8601_24H_FULL_FORMAT
- See Also:
-
ApiResponseErrorPattern
The regex pattern to extract error message from failed API requests- See Also:
-
ApiResponseMessagePattern
The regex pattern to extract response message from failed API requests- See Also:
-
-
Constructor Details
-
SdkHelper
public SdkHelper()
-
-
Method Details
-
findMissingLocales
Calculates and returns the missing locales within the providedList -
filterLocales
Filters out the translated data not needed- Parameters:
data- the data to be filteredfilterLocales- the requested locales- Returns:
- the filtered map data set
-
getAbbreviationFromName
Get the abbreviation from the input string- Parameters:
input- input text to be abbreviatedlength- of the abbreviation- Returns:
- the abbreviated input string in upper case (it does not return null)
-
parseCompetitorsReferences
public static Map<Urn,ReferenceIdCi> parseCompetitorsReferences(List<com.sportradar.uf.sportsapi.datamodel.SapiTeam> competitors, Map<Urn, ReferenceIdCi> currentCompetitorsReferences) Get competitor reference from a list of competitors Note: reference must be checked and updated, since it is not sure that references on summary are the same as on fixture- Parameters:
competitors- competitor id with which is associated referencecurrentCompetitorsReferences- competitor references- Returns:
- map of references per competitor id
-
parseTeamCompetitorsReferences
public static Map<Urn,ReferenceIdCi> parseTeamCompetitorsReferences(List<com.sportradar.uf.sportsapi.datamodel.SapiTeamCompetitor> competitors, Map<Urn, ReferenceIdCi> currentCompetitorsReferences) Get competitor reference from a list of competitors Note: reference must be checked and updated, since it is not sure that references on summary are the same as on fixture- Parameters:
competitors- competitor id with which is associated referencecurrentCompetitorsReferences- competitor references- Returns:
- map of references per competitor id
-
checkConfigurationLocales
-
combineDateAndTime
-
getTimeDifferenceInSeconds
-
toDate
-
toDate
- Throws:
ParseException
-
dateToString
-
doubleToStringWithSign
-
isDataNotFound
-
isDataNotFound
-
stringSetToString
-
integerSetToString
-
dictionaryToString
-
specifierListToString
-
specifierKeyListToString
-
localeListToString
-
checkCauseReason
-
stringIsNullOrEmpty
Check is string is null or empty- Parameters:
input- to be checked- Returns:
- true if null or empty, otherwise false
-
obfuscate
Obfuscate the input string- Parameters:
input- text to be obfuscated- Returns:
- obfuscated string with only first and last 3 letters
-
getUuid
Get the specified size of UUID- Parameters:
size- the substring size- Returns:
- the substring of uuid
-
extractHttpResponseMessage
-
getVersion
-