Class ValueHolderHelper


  • public final class ValueHolderHelper
    extends Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean getBooleanFromVH​(IValueHolder<?> p_vh)
      returns the boolean value of the ValueHolder throws Null pointer Exception when isNull(p_vh) is true or an RuntimeException if p_vh.getValue() is not an int, long or a String that cannot parsed to an int! (when Null allowed use getIntFromVH(IValueHolder<?> p_vh, int nullValue)
      static boolean getBooleanFromVH​(IValueHolder<?> p_vh, boolean p_dNullValue)
      returns the float value of the ValueHolder throws an RuntimeException when p_vh.getValue is not an int or a String cannot parsed to an Int! (when Null allowed use getIntFromVH(IValueHolder<?> p_vh, int nullValue)
      static Boolean getBooleanFromVH​(IValueHolder<?> p_vh, Boolean p_dNullValue)
      returns the float value of the ValueHolder throws an RuntimeException when p_vh.getValue is not an int or a String cannot parsed to an Int! (when Null allowed use getIntFromVH(IValueHolder<?> p_vh, int nullValue)
      static Date getDateFromVH​(IValueHolder<?> p_vh)  
      static Calendar getDateFromVH​(IValueHolder<?> p_vh, TimeZone p_tz)
      returns an UPCalendar from a ValueHolder throws an Exception when the getValue() is not an Date type!
      static double getDoubleFromVH​(IValueHolder<?> p_vh)
      returns the double value of the ValueHolder throws Null pointer Exception when isNull(p_vh) is true or an RuntimeException if p_vh.getValue() is not an int, long, float, double or a String that cannot parsed to an double! (when Null allowed use getDoubleFromVH(IValueHolder<?> p_vh, double p_dNullValue)
      static double getDoubleFromVH​(IValueHolder<?> p_vh, double p_dNullValue)
      returns the double value of the ValueHolder throws an RuntimeException when p_vh.getValue() is not an int, long, double, float or a String that cannot parsed to an double! (when Null allowed use getIntFromVH(IValueHolder<?> p_vh, int nullValue)
      static Double getDoubleFromVH​(IValueHolder<?> p_vh, Double p_dNullValue)
      returns the double value of the ValueHolder throws an RuntimeException when p_vh.getValue() is not an int, long, double, float or a String that cannot parsed to an double! (when Null allowed use getIntFromVH(IValueHolder<?> p_vh, int nullValue)
      static float getFloatFromVH​(IValueHolder<?> p_vh)
      returns the float value of the ValueHolder throws Null pointer Exception when isNull(p_vh) is true or an RuntimeException if p_vh.getValue() is not an int, long, float, double or a String that cannot parsed to an float! (when Null allowed use getFloatFromVH(IValueHolder<?> p_vh, float p_fNullValue)
      static float getFloatFromVH​(IValueHolder<?> p_vh, float p_fNullValue)
      returns the float value of the ValueHolder throws an RuntimeException when p_vh.getValue is not an float, double, long, int or a String that cannot parsed to an float!
      static Float getFloatFromVH​(IValueHolder<?> p_vh, Float p_fNullValue)
      returns the float value of the ValueHolder throws an RuntimeException when p_vh.getValue is not an float, double, long, int or a String that cannot parsed to an float!
      static int getIntFromVH​(IValueHolder<?> p_vh)
      returns the integer value of the ValueHolder throws Null pointer Exception when isNull(p_vh) is true or an RuntimeException if p_vh.getValue() is not an int, long or a String that cannot parsed to an int! (when Null allowed use getIntFromVH(IValueHolder<?> p_vh, int p_iNullValue)
      static int getIntFromVH​(IValueHolder<?> p_vh, int p_iNullValue)
      returns the int value of the ValueHolder throws an RuntimeException when p_vh.getValue is not an int, long or a String that cannot parsed to an Int!
      static Integer getIntFromVH​(IValueHolder<?> p_vh, Integer p_iNullValue)
      returns the int value of the ValueHolder throws an RuntimeException when p_vh.getValue is not an int, long or a String that cannot parsed to an Int!
      static long getLongFromVH​(IValueHolder<?> p_vh)
      returns the long value of the ValueHolder throws Null pointer Exception when isNull(p_vh) is true or an RuntimeException if p_vh.getValue() is not an int, long or a String that cannot parsed to an int! (when Null allowed use getLongFromVH(IValueHolder<?> p_vh, long p_lNullValue)
      static long getLongFromVH​(IValueHolder<?> p_vh, long p_iNullValue)
      returns the long value of the ValueHolder throws an RuntimeException when p_vh.getValue is not an int, long or a String that cannot parsed to an long!
      static Long getLongFromVH​(IValueHolder<?> p_vh, Long p_iNullValue)
      returns the long value of the ValueHolder throws an RuntimeException when p_vh.getValue is not an int, long or a String that cannot parsed to an long!
      static short getShortFromVH​(IValueHolder<?> p_vh)
      returns the short value of the ValueHolder throws Nullpointer Exception when isNull(p_vh) is true or an RuntimeException if p_vh.getValue() is not an short or a String that cannot parsed to an int! (when Null allowd use getShortFromVH(IValueHolder<?> p_vh, short p_lNullValue)
      static short getShortFromVH​(IValueHolder<?> p_vh, short p_sNullValue)
      returns the short value of the ValueHolder throws an RuntimeException when p_vh.getValue is not an short or a String that cannot parsed to an short!
      static Short getShortFromVH​(IValueHolder<?> p_vh, Short p_sNullValue)
      returns the short value of the ValueHolder throws an RuntimeException when p_vh.getValue is not an short or a String that cannot parsed to an short!
      static String getStringFromVH​(IValueHolder<?> p_vh)
      Converts the contents of a value holder to string.
      static String getStringFromVH​(IValueHolder<?> p_vh, String p_strNullValue)  
      static long getTimeInMillisFromVH​(IValueHolder<?> p_vh)  
      static long getTimeInMillisFromVH​(IValueHolder<?> p_vh, long p_lNullValue)  
      static Long getTimeInMillisFromVH​(IValueHolder<?> p_vh, Long p_lNullValue)  
      static Timestamp getTimestampFromVH​(IValueHolder<?> p_vh)  
      static Calendar getUTCDateFromVH​(IValueHolder<?> p_vh)
      returns an UPCalendar from a ValueHolder throws an Exception when the getValue() is not an Date type!
      static boolean isNull​(IValueHolder<?> p_vh)  
      static boolean isNullOrEmpty​(IValueHolder<?> p_vh)  
      static boolean isRawNull​(IValueHolder<?> p_vh)  
    • Constructor Detail

      • ValueHolderHelper

        public ValueHolderHelper()
    • Method Detail

      • getStringFromVH

        public static String getStringFromVH​(IValueHolder<?> p_vh)
        Converts the contents of a value holder to string.
        Parameters:
        p_vh - The value holder
        Returns:
        The converted string or null
      • isNull

        public static final boolean isNull​(IValueHolder<?> p_vh)
        Parameters:
        p_vh -
        Returns:
        true when p_vh == null or p_vh.hasValue() == null
      • isNullOrEmpty

        public static final boolean isNullOrEmpty​(IValueHolder<?> p_vh)
        Parameters:
        p_vh -
        Returns:
        true when p_vh == null || p_vh.getValue() == null || p_vh.getValue().toString().length() == 0
      • isRawNull

        public static final boolean isRawNull​(IValueHolder<?> p_vh)
        Parameters:
        p_vh -
        Returns:
        true when p_vh == null or p_vh.getRawValue() == null
      • getDateFromVH

        public static final Calendar getDateFromVH​(IValueHolder<?> p_vh,
                                                   TimeZone p_tz)
        returns an UPCalendar from a ValueHolder throws an Exception when the getValue() is not an Date type!
        Parameters:
        p_vh -
        p_tz -
        Returns:
        UPCalendar or null
      • getDateFromVH

        public static final Date getDateFromVH​(IValueHolder<?> p_vh)
      • getUTCDateFromVH

        public static final Calendar getUTCDateFromVH​(IValueHolder<?> p_vh)
        returns an UPCalendar from a ValueHolder throws an Exception when the getValue() is not an Date type!
        Parameters:
        p_vh -
        Returns:
        Calendar in UTC or null when isNull(p_vh)
      • getTimeInMillisFromVH

        public static final long getTimeInMillisFromVH​(IValueHolder<?> p_vh)
        Parameters:
        p_vh -
        Returns:
        Time in Milliseconds (UTC) from the DateTime ValueHolder
      • getTimeInMillisFromVH

        public static final long getTimeInMillisFromVH​(IValueHolder<?> p_vh,
                                                       long p_lNullValue)
        Parameters:
        p_vh -
        Returns:
        Time in Milliseconds from the DateTime ValueHolder, or p_lNullValue when isNull(p_vh) == true
      • getTimeInMillisFromVH

        public static final Long getTimeInMillisFromVH​(IValueHolder<?> p_vh,
                                                       Long p_lNullValue)
        Parameters:
        p_vh -
        Returns:
        Time in Milliseconds from the DateTime ValueHolder, or p_lNullValue when isNull(p_vh) == true
      • getIntFromVH

        public static final int getIntFromVH​(IValueHolder<?> p_vh)
        returns the integer value of the ValueHolder throws Null pointer Exception when isNull(p_vh) is true or an RuntimeException if p_vh.getValue() is not an int, long or a String that cannot parsed to an int! (when Null allowed use getIntFromVH(IValueHolder<?> p_vh, int p_iNullValue)
        Parameters:
        p_vh -
        Returns:
        int value of the ValueHolder
      • getIntFromVH

        public static final int getIntFromVH​(IValueHolder<?> p_vh,
                                             int p_iNullValue)
        returns the int value of the ValueHolder throws an RuntimeException when p_vh.getValue is not an int, long or a String that cannot parsed to an Int!
        Parameters:
        p_vh -
        Returns:
        int value of the ValueHolder
      • getIntFromVH

        public static final Integer getIntFromVH​(IValueHolder<?> p_vh,
                                                 Integer p_iNullValue)
        returns the int value of the ValueHolder throws an RuntimeException when p_vh.getValue is not an int, long or a String that cannot parsed to an Int!
        Parameters:
        p_vh -
        Returns:
        int value of the ValueHolder
      • getLongFromVH

        public static final long getLongFromVH​(IValueHolder<?> p_vh)
        returns the long value of the ValueHolder throws Null pointer Exception when isNull(p_vh) is true or an RuntimeException if p_vh.getValue() is not an int, long or a String that cannot parsed to an int! (when Null allowed use getLongFromVH(IValueHolder<?> p_vh, long p_lNullValue)
        Parameters:
        p_vh -
        Returns:
        long value of the ValueHolder
      • getLongFromVH

        public static final long getLongFromVH​(IValueHolder<?> p_vh,
                                               long p_iNullValue)
        returns the long value of the ValueHolder throws an RuntimeException when p_vh.getValue is not an int, long or a String that cannot parsed to an long!
        Parameters:
        p_vh -
        Returns:
        float value of the ValueHolder
      • getLongFromVH

        public static final Long getLongFromVH​(IValueHolder<?> p_vh,
                                               Long p_iNullValue)
        returns the long value of the ValueHolder throws an RuntimeException when p_vh.getValue is not an int, long or a String that cannot parsed to an long!
        Parameters:
        p_vh -
        Returns:
        float value of the ValueHolder
      • getShortFromVH

        public static final short getShortFromVH​(IValueHolder<?> p_vh)
        returns the short value of the ValueHolder throws Nullpointer Exception when isNull(p_vh) is true or an RuntimeException if p_vh.getValue() is not an short or a String that cannot parsed to an int! (when Null allowd use getShortFromVH(IValueHolder<?> p_vh, short p_lNullValue)
        Parameters:
        p_vh -
        Returns:
        short value of the ValueHolder
      • getShortFromVH

        public static final short getShortFromVH​(IValueHolder<?> p_vh,
                                                 short p_sNullValue)
        returns the short value of the ValueHolder throws an RuntimeException when p_vh.getValue is not an short or a String that cannot parsed to an short!
        Parameters:
        p_vh -
        Returns:
        float value of the ValueHolder
      • getShortFromVH

        public static final Short getShortFromVH​(IValueHolder<?> p_vh,
                                                 Short p_sNullValue)
        returns the short value of the ValueHolder throws an RuntimeException when p_vh.getValue is not an short or a String that cannot parsed to an short!
        Parameters:
        p_vh -
        Returns:
        float value of the ValueHolder
      • getFloatFromVH

        public static final float getFloatFromVH​(IValueHolder<?> p_vh)
        returns the float value of the ValueHolder throws Null pointer Exception when isNull(p_vh) is true or an RuntimeException if p_vh.getValue() is not an int, long, float, double or a String that cannot parsed to an float! (when Null allowed use getFloatFromVH(IValueHolder<?> p_vh, float p_fNullValue)
        Parameters:
        p_vh -
        Returns:
        float value of the ValueHolder
      • getFloatFromVH

        public static final float getFloatFromVH​(IValueHolder<?> p_vh,
                                                 float p_fNullValue)
        returns the float value of the ValueHolder throws an RuntimeException when p_vh.getValue is not an float, double, long, int or a String that cannot parsed to an float!
        Parameters:
        p_vh -
        Returns:
        float value of the ValueHolder
      • getFloatFromVH

        public static final Float getFloatFromVH​(IValueHolder<?> p_vh,
                                                 Float p_fNullValue)
        returns the float value of the ValueHolder throws an RuntimeException when p_vh.getValue is not an float, double, long, int or a String that cannot parsed to an float!
        Parameters:
        p_vh -
        Returns:
        float value of the ValueHolder
      • getDoubleFromVH

        public static final double getDoubleFromVH​(IValueHolder<?> p_vh)
        returns the double value of the ValueHolder throws Null pointer Exception when isNull(p_vh) is true or an RuntimeException if p_vh.getValue() is not an int, long, float, double or a String that cannot parsed to an double! (when Null allowed use getDoubleFromVH(IValueHolder<?> p_vh, double p_dNullValue)
        Parameters:
        p_vh -
        Returns:
        double value of the ValueHolder
      • getDoubleFromVH

        public static final double getDoubleFromVH​(IValueHolder<?> p_vh,
                                                   double p_dNullValue)
        returns the double value of the ValueHolder throws an RuntimeException when p_vh.getValue() is not an int, long, double, float or a String that cannot parsed to an double! (when Null allowed use getIntFromVH(IValueHolder<?> p_vh, int nullValue)
        Parameters:
        p_vh -
        Returns:
        double value of the ValueHolder
      • getDoubleFromVH

        public static final Double getDoubleFromVH​(IValueHolder<?> p_vh,
                                                   Double p_dNullValue)
        returns the double value of the ValueHolder throws an RuntimeException when p_vh.getValue() is not an int, long, double, float or a String that cannot parsed to an double! (when Null allowed use getIntFromVH(IValueHolder<?> p_vh, int nullValue)
        Parameters:
        p_vh -
        Returns:
        double value of the ValueHolder
      • getBooleanFromVH

        public static final boolean getBooleanFromVH​(IValueHolder<?> p_vh)
        returns the boolean value of the ValueHolder throws Null pointer Exception when isNull(p_vh) is true or an RuntimeException if p_vh.getValue() is not an int, long or a String that cannot parsed to an int! (when Null allowed use getIntFromVH(IValueHolder<?> p_vh, int nullValue)
        Parameters:
        p_vh -
        Returns:
        double value of the ValueHolder
      • getBooleanFromVH

        public static final boolean getBooleanFromVH​(IValueHolder<?> p_vh,
                                                     boolean p_dNullValue)
        returns the float value of the ValueHolder throws an RuntimeException when p_vh.getValue is not an int or a String cannot parsed to an Int! (when Null allowed use getIntFromVH(IValueHolder<?> p_vh, int nullValue)
        Parameters:
        p_vh -
        Returns:
        float value of the ValueHolder
      • getBooleanFromVH

        public static final Boolean getBooleanFromVH​(IValueHolder<?> p_vh,
                                                     Boolean p_dNullValue)
        returns the float value of the ValueHolder throws an RuntimeException when p_vh.getValue is not an int or a String cannot parsed to an Int! (when Null allowed use getIntFromVH(IValueHolder<?> p_vh, int nullValue)
        Parameters:
        p_vh -
        Returns:
        float value of the ValueHolder