com.ibm.commerce.price.utils

Class GeneralDataUtil

  • java.lang.Object
    • com.ibm.commerce.price.utils.GeneralDataUtil


  • public class GeneralDataUtil
    extends java.lang.Object
    This helper class provides some basic functions to manage objects like String, Collections, etc.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String COPYRIGHT
      IBM copyright notice field.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static int compare(java.math.BigDecimal dec1, java.math.BigDecimal dec2)
      Compare two BigDecimal numbers.
      static int compare(java.lang.Double dec1, java.lang.Double dec2)
      Compare two Double numbers.
      static int compare(java.lang.String s1, java.lang.String s2)
      Compare two Strings for default locale.
      static int compare(java.lang.String s1, java.lang.String s2, java.util.Locale locale)
      Compare two Strings for the specified locale.
      static boolean isEmpty(java.util.Collection col)
      Check if a collection is null or empty
      static boolean isEmpty(java.lang.Object[] objs)
      Check if an array is null or empty
      static boolean isEmpty(java.lang.String s)
      Check if a string is null or empty
      static int sign(double d)
      Get the sign of a double
      static java.lang.Long[] stringArrayToLongArray(java.lang.String[] ss)
      Convert an array of strings to an array of Long
      static java.lang.String toString(java.lang.Object[] objs)
      Convert an array to string utilizing the toString() method of the array element.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM copyright notice field.
        See Also:
        Constant Field Values
    • Method Detail

      • compare

        public static int compare(java.math.BigDecimal dec1,
                                  java.math.BigDecimal dec2)
        Compare two BigDecimal numbers. View null as zero.
        Parameters:
        dec1 - A BigDecimal
        dec2 - A BigDecimal
        Returns:
        boolean
      • compare

        public static int compare(java.lang.Double dec1,
                                  java.lang.Double dec2)
        Compare two Double numbers. View null as zero.
        Parameters:
        dec1 - A Double object
        dec2 - A Double object
        Returns:
        boolean
      • compare

        public static int compare(java.lang.String s1,
                                  java.lang.String s2)
        Compare two Strings for default locale.
        Parameters:
        s1 - A String object
        s2 - A String object
        Returns:
        boolean
      • compare

        public static int compare(java.lang.String s1,
                                  java.lang.String s2,
                                  java.util.Locale locale)
        Compare two Strings for the specified locale.
        Parameters:
        s1 - A String object
        s2 - A String object
        locale - A Locale object
        Returns:
        boolean
      • isEmpty

        public static boolean isEmpty(java.util.Collection col)
        Check if a collection is null or empty
        Parameters:
        col - A collection to be checked
        Returns:
        boolean Return true if the collection is null or empty
      • isEmpty

        public static boolean isEmpty(java.lang.Object[] objs)
        Check if an array is null or empty
        Parameters:
        objs - An array to be checked
        Returns:
        boolean Return true if the array is null or empty
      • isEmpty

        public static boolean isEmpty(java.lang.String s)
        Check if a string is null or empty
        Parameters:
        s - A string to be checked
        Returns:
        boolean Return true if the string is null or empty
      • sign

        public static int sign(double d)
        Get the sign of a double
        Parameters:
        d - A double
        Returns:
        int
      • stringArrayToLongArray

        public static java.lang.Long[] stringArrayToLongArray(java.lang.String[] ss)
        Convert an array of strings to an array of Long
        Parameters:
        ss - A string array
        Returns:
        A Long array
      • toString

        public static java.lang.String toString(java.lang.Object[] objs)
        Convert an array to string utilizing the toString() method of the array element.
        Parameters:
        objs - An Object array
        Returns:
        String