Package snap.util

Class Convert

java.lang.Object
snap.util.Convert

public class Convert extends Object
This class holds utilities to convert values.
  • Constructor Details

    • Convert

      public Convert()
  • Method Details

    • boolValue

      public static boolean boolValue(Object anObj)
      Returns a boolean value for the given object.
    • intValue

      public static int intValue(Object anObj)
      Returns the int value for a given object (assumed to be a string or number).
    • longValue

      public static long longValue(Object anObj)
      Returns the int value for a given object (assumed to be a string or number).
    • floatValue

      public static float floatValue(Object anObj)
      Returns the float value for a given object (assumed to be a string or number).
    • doubleValue

      public static double doubleValue(Object anObj)
      Returns the double value for a given object (assumed to be a string or number).
    • stringValue

      public static String stringValue(Object anObj)
      Returns a String for a given arbitrary object.
    • booleanValue

      public static Boolean booleanValue(Object anObj)
      Returns the Boolean for a given object (assumed to be Number or String).
    • numberValue

      public static Number numberValue(Object anObj)
      Returns the Number for a given object (assumed to be Number or String).
    • getInteger

      public static Integer getInteger(Object anObj)
      Returns the Integer for a given object.
    • getFloat

      public static Float getFloat(Object anObj)
      Returns a Float for a given object.
    • getDouble

      public static Double getDouble(Object anObj)
      Returns a Double for a given object.
    • getBigDecimal

      public static BigDecimal getBigDecimal(Object anObj)
      Returns the BigDecimal for a given object (assumed to be a string or number).
    • floatArrayToDouble

      public static double[] floatArrayToDouble(float[] theFloats)
      Returns a double array for given floats.
    • doubleArrayToFloat

      public static float[] doubleArrayToFloat(double[] theDoubles)
      Returns a float array for given doubles.
    • doubleArrayToString

      public static String doubleArrayToString(double[] theValues)
      Return string for double array.
    • stringToDoubleArray

      public static double[] stringToDoubleArray(String aStr)
      Returns an array of double values for given comma separated string.
    • stringToStringArray

      public static String[] stringToStringArray(String aStr)
      Returns an array of String values for given comma separated string.
    • getDate

      public static Date getDate(Object anObj)
      Returns a date for given object of arbitrary type.