Class FormatUtils

java.lang.Object
org.jumpmind.util.FormatUtils

public final class FormatUtils extends Object
  • Field Details

    • TIMESTAMP_PATTERNS

      public static final String[] TIMESTAMP_PATTERNS
    • TIME_PATTERNS

      public static final String[] TIME_PATTERNS
    • TIMESTAMP_WITH_TIMEZONE_PATTERNS

      public static final String[] TIMESTAMP_WITH_TIMEZONE_PATTERNS
    • TIMESTAMP_FORMATTER

      public static final org.apache.commons.lang3.time.FastDateFormat TIMESTAMP_FORMATTER
    • DATE_FORMATTER

      public static final org.apache.commons.lang3.time.FastDateFormat DATE_FORMATTER
    • TIMESTAMP9_FORMATTER

      public static final DateTimeFormatter TIMESTAMP9_FORMATTER
    • TIME_FORMATTER

      public static final org.apache.commons.lang3.time.FastDateFormat TIME_FORMATTER
    • TIME9_FORMATTER

      public static final DateTimeFormatter TIME9_FORMATTER
    • WILDCARD

      public static final String WILDCARD
      See Also:
    • WILDCARD_SEPARATOR

      public static final String WILDCARD_SEPARATOR
      See Also:
    • NEGATE_TOKEN

      public static final String NEGATE_TOKEN
      See Also:
    • WILDCARD_SEPARATOR_CHAR

      public static final char WILDCARD_SEPARATOR_CHAR
    • WILDCARD_CHAR

      public static final char WILDCARD_CHAR
    • NEGATE_TOKEN_CHAR

      public static final char NEGATE_TOKEN_CHAR
    • WILDCARD_ESCAPED

      public static final String WILDCARD_ESCAPED
      See Also:
    • WILDCARD_SEPARATOR_ESCAPED

      public static final String WILDCARD_SEPARATOR_ESCAPED
      See Also:
    • NEGATE_TOKEN_ESCAPED

      public static final String NEGATE_TOKEN_ESCAPED
      See Also:
    • MAX_CHARS_TO_LOG

      public static final int MAX_CHARS_TO_LOG
      See Also:
  • Method Details

    • replace

      public static String replace(String prop, String replaceWith, String sourceString)
    • replaceToken

      public static String replaceToken(String text, String tokenToReplace, String replaceWithText, boolean matchUsingPrefixSuffix)
    • replaceTokens

      public static String replaceTokens(String text, Map<String,String> replacements, boolean matchUsingPrefixSuffix)
      Replace the keys found in the target text with the values found in the replacements map.
      Parameters:
      text - The text to replace
      replacements - The map that contains the replacement values
      matchUsingPrefixSuffix - If true, look for the $(key) pattern to replace. If false, just replace the key outright.
      Returns:
      The text with the token keys replaced
    • formatString

      public static String formatString(String format, String arg)
    • toBoolean

      public static boolean toBoolean(String value)
    • isMixedCase

      public static boolean isMixedCase(String text)
    • isWildCardMatch

      public static boolean isWildCardMatch(String text, String pattern, boolean ignoreCase)
    • isWildCardMatch

      public static boolean isWildCardMatch(String text, String pattern)
    • unescapeWildCards

      public static String unescapeWildCards(String str)
    • escapeWildCards

      public static String escapeWildCards(String str)
    • isWildCarded

      public static boolean isWildCarded(String str)
    • wordWrap

      public static String[] wordWrap(String str, int firstLineSize, int nonFirstLineSize)
      Word wrap a string where the line size for the first line is different than the lines sizes for the other lines.
      Parameters:
      str -
      firstLineSize -
      nonFirstLineSize -
      Returns:
    • wordWrap

      public static String[] wordWrap(String str, int lineSize)
    • abbreviateForLogging

      public static String abbreviateForLogging(String value)
    • abbreviateForLogging

      public static String abbreviateForLogging(List list, int maxCharsToLog)
      Convert list of objects to abbreviated string for logging, making efficient use of memory for large lists
    • parseDate

      public static Date parseDate(String str, String[] parsePatterns)
    • parseDate

      public static Date parseDate(String str, String[] parsePatterns, TimeZone timeZone)
    • parseTimestampWithTimezone

      public static Timestamp parseTimestampWithTimezone(String str)
    • parseTimestampWithTimezone

      public static Timestamp parseTimestampWithTimezone(String str, String[] parsePatterns)
    • splitOnSpacePreserveQuotedStrings

      public static String[] splitOnSpacePreserveQuotedStrings(String source)
    • replaceCharsToShortenName

      public static String replaceCharsToShortenName(String name)
    • lower

      public static String lower(String str)
    • upper

      public static String upper(String str)
    • isInfamousTurkey

      public static boolean isInfamousTurkey()
    • stripTurkeyDottedI

      public static String stripTurkeyDottedI(String str)
    • formatDurationReadable

      public static String formatDurationReadable(long duration)
    • formatDateTimeISO

      public static String formatDateTimeISO(Date date)
    • isInteger

      public static boolean isInteger(String s)
    • convertToPem

      public static String convertToPem(X509Certificate cert) throws CertificateEncodingException
      Throws:
      CertificateEncodingException