Class ConversionHelper

java.lang.Object
com.polarion.core.util.types.ConversionHelper

@Deprecated(since="3.24.4", forRemoval=true) public class ConversionHelper extends Object
Deprecated, for removal: This API element is subject to removal in a future version.
Helper for type conversions.

The general contract applied for the conversion methods of this class is that

  • when object is null, defaultValue is returned
  • when object is an instance of the desired type, reference to it is returned
  • when the conversion fails, defaultValue is returned
  • null is returned only in the case when both object and defaultValue are null
Version:
$Revision: 1.3 $ $Date: 2003/12/29 18:58:51 $
Author:
Ondrej Chylik, Polarion Software
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    getBoolean(Object object, boolean defaultValue)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Converts an object to primitive boolean type.
    static Boolean
    getBoolean(Object object, Boolean defaultValue)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Converts an object to Boolean.
    static byte
    getByte(Object object, byte defaultValue)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Converts an object to primitive byte type.
    static Byte
    getByte(Object object, Byte defaultValue)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Converts an object to Byte.
    static double
    getDouble(Object object, double defaultValue)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Converts an object to primitive double type.
    static Double
    getDouble(Object object, Double defaultValue)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Converts an object to Double.
    static float
    getFloat(Object object, float defaultValue)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Converts an object to primitive float type.
    static Float
    getFloat(Object object, Float defaultValue)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Converts an object to Float.
    static int
    getInt(Object object, int defaultValue)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Converts an object to primitive int type.
    static Integer
    getIntenger(Object object, Integer defaultValue)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Converts an object to Integer.
    static long
    getLong(Object object, long defaultValue)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Converts an object to primitive long type.
    static Long
    getLong(Object object, Long defaultValue)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Converts an object to Long.
    static Object
    getObject(Object object, Class<?> type, Object defaultValue)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Converts an object to the specified type.
    static short
    getShort(Object object, short defaultValue)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Converts an object to primitive short type.
    static Short
    getShort(Object object, Short defaultValue)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Converts an object to Short.
    static String
    getString(Object object, String defaultValue)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Converts an object to string.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getString

      public static String getString(Object object, String defaultValue)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Converts an object to string.
    • getObject

      public static Object getObject(Object object, Class<?> type, Object defaultValue)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Converts an object to the specified type.

      Note: Default value which is not an instance of the given type is an invalid argument for this method.

    • getBoolean

      public static boolean getBoolean(Object object, boolean defaultValue)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Converts an object to primitive boolean type. String to boolean conversion applies to values "true", "on" or "yes" and "false", "off" or "no", case insensitive.
    • getInt

      public static int getInt(Object object, int defaultValue)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Converts an object to primitive int type. Applies to any instance of Number or to strings.
    • getLong

      public static long getLong(Object object, long defaultValue)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Converts an object to primitive long type. Applies to any instance of Number or to strings.
    • getFloat

      public static float getFloat(Object object, float defaultValue)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Converts an object to primitive float type. Applies to any instance of Number or to strings.
    • getDouble

      public static double getDouble(Object object, double defaultValue)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Converts an object to primitive double type. Applies to any instance of Number or to strings.
    • getByte

      public static byte getByte(Object object, byte defaultValue)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Converts an object to primitive byte type. Applies to any instance of Number or to strings.
    • getShort

      public static short getShort(Object object, short defaultValue)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Converts an object to primitive short type. Applies to any instance of Number or to strings.
    • getBoolean

      public static Boolean getBoolean(Object object, Boolean defaultValue)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Converts an object to Boolean. String to boolean conversion applies to values "true", "on" or "yes" and "false", "off" or "no", case insensitive.
    • getIntenger

      public static Integer getIntenger(Object object, Integer defaultValue)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Converts an object to Integer. Applies to any instance of Number or to strings.
    • getLong

      public static Long getLong(Object object, Long defaultValue)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Converts an object to Long. Applies to any instance of Number or to strings.
    • getFloat

      public static Float getFloat(Object object, Float defaultValue)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Converts an object to Float. Applies to any instance of Number or to strings.
    • getDouble

      public static Double getDouble(Object object, Double defaultValue)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Converts an object to Double. Applies to any instance of Double or to strings.
    • getByte

      public static Byte getByte(Object object, Byte defaultValue)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Converts an object to Byte. Applies to any instance of Number or to strings.
    • getShort

      public static Short getShort(Object object, Short defaultValue)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Converts an object to Short. Applies to any instance of Number or to strings.