Class SeeqStrings

java.lang.Object
com.seeq.utilities.SeeqStrings

public class SeeqStrings extends Object
  • Field Details

  • Constructor Details

    • SeeqStrings

      public SeeqStrings()
  • Method Details

    • format

      public String format(String template, Object... args)
      A variant of Guava's Preconditions formatter that substitutes each {} in template with an argument. Intended to match Slf4j's style. These are matched by position: the first {} gets args[0], etc. If there are more arguments than place holders, the unmatched arguments will be appended to the end of the formatted message in square braces.
      Parameters:
      template - A string containing 0 or more {} place holders. null is treated as "null".
      args - The arguments to be substituted into the message template. Arguments are converted to strings using String.valueOf(Object). Arguments can be null.
    • parseUUID

      public static UUID parseUUID(String id)
      Some interfaces, such as the BatchSignalDriver specify a String id, but internally many connectors use UUID * ids to store the data. This method should be used to parse data ids into UUIDs as it will ensure that if the * id is not a UUID it will be converted into one. See CRAB-8909.
      Parameters:
      id - A string ID to encode as a UUID using an MD5 hash.
      Returns:
      The UUID encoding of the string id.
    • getGuidString

      public static String getGuidString(UUID guid)
      Convert a GUID to its uppercase string representation
      Parameters:
      guid - The UUID to convert to a string representation
      Returns:
      An uppercase string representation of the GUID
    • sanitizeHtml

      public static String sanitizeHtml(String html)
      Sanitizes the passed string using the OWASP Java HTML Sanitizer. This will filter out script blocks, make sure only certain attributes are allowed, add rel attribute to links specifying the browser not to pass on any information etc.
      Parameters:
      html - The string to sanitize
      Returns:
      The sanitized string
    • removeHtml

      public static String removeHtml(String html)
      Removes HTML from the passed string using the OWASP Java HTML Sanitizer. This should only leave plaintext.
      Parameters:
      html - The string to de-html
      Returns:
      The de-htmled string