/** {@inheritDoc} */ @Override public Object convertValueForScript( final Object value, final ValueConverter globalDelegate, final Class<?> expectedClass) { if (!(value instanceof String)) { throw new IllegalArgumentException("value must be a " + String.class); } return globalDelegate.convertValueForScript(Double.valueOf((String) value), expectedClass); }
/** {@inheritDoc} */ @Override public boolean canConvertValueForScript( final Object value, final ValueConverter globalDelegate, final Class<?> expectedClass) { boolean canConvert = value instanceof String && (expectedClass.isAssignableFrom(Number.class) || SIMPLE_NUMBER_CLASSES.contains(expectedClass)); if (canConvert) { try { canConvert = globalDelegate.canConvertValueForScript(Double.valueOf((String) value), expectedClass); } catch (final NumberFormatException ex) { canConvert = false; } } return canConvert; }