private Object doConvertInput(ConversionService<?> conversionService, Argument<?> arg, Object object) { ArgumentConversionContext conversionContext = ConversionContext.of(arg); Optional<?> convert = conversionService.convert(object, conversionContext); if (convert.isPresent()) { return convert.get(); } else { Optional<ConversionError> lastError = conversionContext.getLastError(); if (lastError.isPresent()) { throw new ConversionErrorException(arg, lastError.get()); } } return null; } }
final Optional<ConversionError> lastError = conversionContext.getLastError(); if (lastError.isPresent()) { throw new ConversionErrorException(argument, lastError.get()); } else { throw new UnsatisfiedArgumentException(argument);
/** * @param argument The argument * @param conversionContext The conversion context * @param result An optional result * @return The resolved value or an error */ protected Object resolveValueOrError(Argument argument, ConversionContext conversionContext, Optional<?> result) { if (!result.isPresent()) { Optional<ConversionError> lastError = conversionContext.getLastError(); if (!lastError.isPresent() && argument.isDeclaredAnnotationPresent(Nullable.class)) { return null; } throw lastError.map(conversionError -> (RuntimeException) new ConversionErrorException(argument, conversionError)).orElseGet(() -> new UnsatisfiedRouteException(argument) ); } else { return result.get(); } }
name = NameUtils.decapitalize(type.getSimpleName()); return new ConversionErrorException(Argument.of(ife.getTargetType(), name), conversionError); } else { return new ConversionErrorException(Argument.of(type), conversionError);
if (resolved instanceof ConversionError) { ConversionError conversionError = (ConversionError) resolved; throw new ConversionErrorException(argument, conversionError); } else { ConversionContext conversionContext = ConversionContext.of(argument); throw new ConversionErrorException(argument, conversionError); } else { throw new UnsatisfiedRouteException(argument); throw new ConversionErrorException(argument, (ConversionError) value); } else if (value == DefaultRouteBuilder.NO_VALUE) { throw new UnsatisfiedRouteException(argument);