@Test(expectedExceptions = IllegalArgumentException.class) public void testObject() { Conversions.variantToInteger(new Object()); }
public static Integer variantToInteger(Object variant) { if (variant instanceof Number) { return ((Number) variant).intValue(); } else { throw new IllegalArgumentException(String.format("Variant of type \"%s\", and value \"%s\" is not a Number.", variant.getClass(), variant)); } }
Conversions { public static Integer variantToInteger(Object variant) { if (variant instanceof Number) { return ((Number) variant).intValue(); } else { throw new IllegalArgumentException(String.format("Variant of type \"%s\", and value \"%s\" is not a Number.", variant.getClass(), variant)); } } }
Conversions { public static Integer variantToInteger(Object variant) { if (variant instanceof Number) { return ((Number) variant).intValue(); } else { throw new IllegalArgumentException(String.format("Variant of type \"%s\", and value \"%s\" is not a Number.", variant.getClass(), variant)); } }  }
Conversions { public static Integer variantToInteger(Object variant) { if (variant instanceof Number) { return ((Number) variant).intValue(); } else { throw new IllegalArgumentException(String.format("Variant of type \"%s\", and value \"%s\" is not a Number.", variant.getClass(), variant)); } }  static Integer variantToInteger(Object variant); static DateTime variantToDateTime(final Object variant); static DateTime variantToDateTime(final Object variant, final DateTimeZone timeZone); @SuppressWarnings("unchecked") static T variantToEnum(final Object variant, final Class<T> enumClazz); static Boolean variantToBoolean(final Object input); }
Conversions { public static Integer variantToInteger(Object variant) { if (variant instanceof Number) { return ((Number) variant).intValue(); } else { throw new IllegalArgumentException(String.format("Variant of type \"%s\", and value \"%s\" is not a Number.", variant.getClass(), variant)); } }  static Integer variantToInteger(Object variant); static DateTime variantToDateTime(final Object variant); static DateTime variantToDateTime(final Object variant, final DateTimeZone timeZone); @SuppressWarnings("unchecked") static T variantToEnum(final Object variant, final Class<T> enumClazz); static Boolean variantToBoolean(final Object input);  }