Class SdkHelper

java.lang.Object
com.sportradar.utils.SdkHelper

public final class SdkHelper extends Object
An utility class that contains various methods which perform common language tasks
  • Field Details

    • ExecutionLog

      public static final org.slf4j.Logger ExecutionLog
    • MarketDescriptionMinFetchInterval

      public static int MarketDescriptionMinFetchInterval
    • InVariantMarketListCache

      public static String InVariantMarketListCache
    • VariantMarketSingleCache

      public static String VariantMarketSingleCache
    • VariantMarketListCache

      public static String VariantMarketListCache
    • ISO_8601_24H_FORMAT

      public static final String ISO_8601_24H_FORMAT
      See Also:
    • ISO_8601_24H_FULL_FORMAT

      public static final String ISO_8601_24H_FULL_FORMAT
      See Also:
    • ApiResponseErrorPattern

      public static final String ApiResponseErrorPattern
      The regex pattern to extract error message from failed API requests
      See Also:
    • ApiResponseMessagePattern

      public static final String ApiResponseMessagePattern
      The regex pattern to extract response message from failed API requests
      See Also:
  • Constructor Details

    • SdkHelper

      public SdkHelper()
  • Method Details

    • findMissingLocales

      public static List<Locale> findMissingLocales(Collection<Locale> have, List<Locale> want)
      Calculates and returns the missing locales within the provided List
      Parameters:
      have - - a List that contains all the available locales
      want - - a List of locales that are required
      Returns:
      - returns a List of missing locales
    • filterLocales

      public static Map<Locale,String> filterLocales(Map<Locale,String> data, List<Locale> filterLocales)
      Filters out the translated data not needed
      Parameters:
      data - the data to be filtered
      filterLocales - the requested locales
      Returns:
      the filtered map data set
    • getAbbreviationFromName

      public static String getAbbreviationFromName(String input, int length)
      Get the abbreviation from the input string
      Parameters:
      input - input text to be abbreviated
      length - 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 reference
      currentCompetitorsReferences - 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 reference
      currentCompetitorsReferences - competitor references
      Returns:
      map of references per competitor id
    • checkConfigurationLocales

      public static Locale checkConfigurationLocales(Locale defaultLocale, Set<Locale> supportedLocales)
    • combineDateAndTime

      public static Date combineDateAndTime(Date date, Date time)
    • getTimeDifferenceInSeconds

      public static long getTimeDifferenceInSeconds(Date d1, Date d2)
    • toDate

      public static Date toDate(XMLGregorianCalendar gregorianCalendar)
    • toDate

      public static Date toDate(String dateString) throws ParseException
      Throws:
      ParseException
    • dateToString

      public static String dateToString(Date date)
    • doubleToStringWithSign

      public static String doubleToStringWithSign(double value)
    • isDataNotFound

      public static boolean isDataNotFound(Throwable e)
    • isDataNotFound

      public static boolean isDataNotFound(Throwable e, int counter)
    • stringSetToString

      public static String stringSetToString(Set<String> set)
    • integerSetToString

      public static String integerSetToString(Set<Integer> set)
    • dictionaryToString

      public static String dictionaryToString(Map<String,String> dict)
    • specifierListToString

      public static String specifierListToString(List<Specifier> specifiers)
    • specifierKeyListToString

      public static String specifierKeyListToString(List<Specifier> specifiers)
    • localeListToString

      public static String localeListToString(List<Locale> locales)
    • checkCauseReason

      public static boolean checkCauseReason(Throwable cause, String message)
    • stringIsNullOrEmpty

      public static boolean stringIsNullOrEmpty(String input)
      Check is string is null or empty
      Parameters:
      input - to be checked
      Returns:
      true if null or empty, otherwise false
    • obfuscate

      public static String obfuscate(String input)
      Obfuscate the input string
      Parameters:
      input - text to be obfuscated
      Returns:
      obfuscated string with only first and last 3 letters
    • getUuid

      public static String getUuid(int size)
      Get the specified size of UUID
      Parameters:
      size - the substring size
      Returns:
      the substring of uuid
    • extractHttpResponseMessage

      public static String extractHttpResponseMessage(String responseContent)
    • getVersion

      public static String getVersion()