@Override public Object convertAssignableToValidValue(Object value) { if (value == null) { return null; } try { if (value instanceof Number) { return ((Number) value).longValue(); } else { return Long.valueOf(value.toString()); } } catch (Exception e) { throw new RuntimeException("Invalid value"); } }
@Override public boolean isAssignableValue(Object value) { if (value == null) { return nullable; } try { long longValue; if (value instanceof Number) { longValue = ((Number) value).longValue(); } else { longValue = Long.valueOf(value.toString()); } return (minValue <= longValue) && (longValue <= maxValue); } catch (Exception e) { return false; } }