class StringToNumberConverter extends AbstractConverter {

    @Override
    public boolean canHandle(Object source, TypeToken<?> targetTypeToken) {
        if (targetTypeToken.isPrimitive()) {
            targetTypeToken = PrimitiveTypeUtils.toWrapperTypeToken(targetTypeToken);
        }
        if (!targetTypeToken.isSubtypeOf(Number.class)) return false;

        if (!(source instanceof String)) return false;

        try {
            NumberUtils.parseNumber((String) source, (Class) targetTypeToken.getType());
            return true;
        } catch (IllegalArgumentException e){
            return false;
        }
    }

}