Class Functions


  • public class Functions
    extends Object
    INTERNAL: A collection of DB2TM functions intended to be used in the function-column element.
    • Constructor Detail

      • Functions

        public Functions()
    • Method Detail

      • asIs

        public static String asIs​(String str)
        INTERNAL: Returns the string argument as-is. This is useful because parameters can be constructed as patterns.
      • toUpperCase

        public static String toUpperCase​(String str)
        INTERNAL: Uppercases the given String. If the parameter is null it returns null.
      • toLowerCase

        public static String toLowerCase​(String str)
        INTERNAL: Lowercases the given String. If the parameter is null it returns null.
      • trim

        public static String trim​(String str)
        INTERNAL: Trims the given String. If the parameter is null it returns null.
      • ifEqualThenElse

        public static String ifEqualThenElse​(String str1,
                                             String str2,
                                             String thenval,
                                             String elseval)
        INTERNAL: Compares the first two arguments. If they are equal the third argument is returned, if not the fourth one is.
      • ifEmptyThenElse

        public static String ifEmptyThenElse​(String str,
                                             String thenval,
                                             String elseval)
        INTERNAL: Checks to see that the string is null or empty. If it is then the then value is returned, otherwise the else value.
      • useFirstIfDifferent

        public static String useFirstIfDifferent​(String str1,
                                                 String str2)
        INTERNAL: Returns the first argument if the two arguments are different. If they are equal null is returned.
      • useFirstIfEqual

        public static String useFirstIfEqual​(String str1,
                                             String str2)
        INTERNAL: Returns the first argument if the two arguments are equal. If they are different null is returned.
      • coalesce

        public static String coalesce​(String str1,
                                      String str2)
        INTERNAL: Returns the first non-null argument.
      • coalesce

        public static String coalesce​(String str1,
                                      String str2,
                                      String str3)
        INTERNAL: Returns the first non-null argument.
      • coalesceThen

        public static String coalesceThen​(String str1,
                                          String then1)
        INTERNAL: Same as coalesce, but will return then-argument instead of the checked value. Will return null if none of the checked values are non-empty.
      • coalesceThen

        public static String coalesceThen​(String str1,
                                          String then1,
                                          String str2,
                                          String then2)
        INTERNAL: Same as coalesce, but will return then-argument instead of the checked value. Will return null if none of the checked values are non-empty.
      • failIfEmpty

        public static String failIfEmpty​(String str,
                                         String message)
        INTERNAL: Function will throw an exception with the given message if the string value is null or empty.
      • stringReplaceAll

        public static String stringReplaceAll​(String str,
                                              String regex,
                                              String toValue)
        INTERNAL: Replace all occurrences of a regex in a string with a new value.
      • makePSI

        public static String makePSI​(String str)
        INTERNAL: Turn a string into a suffix suitable for a PSI.
      • stripSpaces

        public static String stripSpaces​(String str)
        INTERNAL: Returns the string minus all spaces. Differs from trim() in that internal spaces are also removed.