@Test public void testLongField () { Assert.assertTrue(ConfigFieldValidation.isLongAndInRange(0, Long.MIN_VALUE, Long.MAX_VALUE)); Assert.assertFalse(ConfigFieldValidation.isLongAndInRange(null, Long.MIN_VALUE, Long.MAX_VALUE)); Assert.assertFalse(ConfigFieldValidation.isLongAndInRange(Long.MIN_VALUE, Long.MIN_VALUE + 1, Long.MAX_VALUE)); Assert.assertFalse(ConfigFieldValidation.isLongAndInRange(Long.MAX_VALUE, Long.MIN_VALUE, Long.MAX_VALUE - 1)); }
public static boolean isLongAndInRange (Object value, long min, long max) { boolean result = false; if (isInteger(value)) { Integer i = (Integer) value; result = isInRange(i, min, max); } else if (isLong(value)) { Long l = (Long) value; result = isInRange(l, min, max); } return result; }
ConfigFieldValidation { public static boolean isLongAndInRange (Object value, long min, long max) { boolean result = false; if (isInteger(value)) { Integer i = (Integer) value; result = isInRange(i, min, max); } else if (isLong(value)) { Long l = (Long) value; result = isInRange(l, min, max); } return result; } }
ConfigFieldValidation { public static boolean isLongAndInRange (Object value, long min, long max) { boolean result = false; if (isInteger(value)) { Integer i = (Integer) value; result = isInRange(i, min, max); } else if (isLong(value)) { Long l = (Long) value; result = isInRange(l, min, max); } return result; }  }
ConfigFieldValidation { public static boolean isLongAndInRange (Object value, long min, long max) { boolean result = false; if (isInteger(value)) { Integer i = (Integer) value; result = isInRange(i, min, max); } else if (isLong(value)) { Long l = (Long) value; result = isInRange(l, min, max); } return result; }  static boolean isSubType(Class clazz, Object value); static boolean isBoolean(Object value); static boolean isInteger(Object value); static boolean isLong(Object value); static boolean isDouble(Object value); static boolean isString(Object value); static boolean isList(Object value); static boolean isByteAndInRange(Object value, byte min, byte max); static boolean isShortAndInRange(Object value, short min, short max); static boolean isIntAndInRange(Object value, int min, int max); static boolean isLongAndInRange(Object value, long min, long max); static boolean isFloatOrDouble(Object value); static boolean isStringAndNotEmpty(Object value); static boolean isInRange(int value, int min, int max); static boolean isInRange(long value, long min, long max); }
ConfigFieldValidation { public static boolean isLongAndInRange (Object value, long min, long max) { boolean result = false; if (isInteger(value)) { Integer i = (Integer) value; result = isInRange(i, min, max); } else if (isLong(value)) { Long l = (Long) value; result = isInRange(l, min, max); } return result; }  static boolean isSubType(Class clazz, Object value); static boolean isBoolean(Object value); static boolean isInteger(Object value); static boolean isLong(Object value); static boolean isDouble(Object value); static boolean isString(Object value); static boolean isList(Object value); static boolean isByteAndInRange(Object value, byte min, byte max); static boolean isShortAndInRange(Object value, short min, short max); static boolean isIntAndInRange(Object value, int min, int max); static boolean isLongAndInRange(Object value, long min, long max); static boolean isFloatOrDouble(Object value); static boolean isStringAndNotEmpty(Object value); static boolean isInRange(int value, int min, int max); static boolean isInRange(long value, long min, long max);  }