Class TypeConversion

java.lang.Object
com.github.basking2.sdsai.itrex.util.TypeConversion

public class TypeConversion extends Object
Standard ways to convert between types.
  • Constructor Details

    • TypeConversion

      public TypeConversion()
  • Method Details

    • toString

      public static String toString(Object o)
    • toInt

      public static int toInt(Object o)
    • toFloat

      public static float toFloat(Object o)
    • toLong

      public static long toLong(Object o)
    • toDouble

      public static double toDouble(Object o)
    • toBoolean

      public static boolean toBoolean(Object o)
      Convert the parameter o to a boolean using its truthy or falsey ness.
      1. Null is false.
      2. The strings "false", "0", "no", "f", and "off" all result in a false value.
      3. Everything not listed above results in true.
      Parameters:
      o - The object to convert to a boolean.
      Returns:
      The boolean value of o.