@Override public Object onFailure(ConfigurationPropertyName name, Bindable<?> target, BindContext context, Exception error) throws Exception { if (context.getDepth() == 0 && error instanceof ConverterNotFoundException) { return null; } throw error; }
@Override public void onFinish(ConfigurationPropertyName name, Bindable<?> target, BindContext context, Object result) throws Exception { if (context.getDepth() == 0) { checkNoUnboundElements(name, context); } }
private Object getValidationTarget(Bindable<?> target, BindContext context, Object result) { if (result != null) { return result; } if (context.getDepth() == 0 && target.getValue() != null) { return target.getValue().get(); } return null; }
private void validate(ConfigurationPropertyName name, Bindable<?> target, BindContext context, Object result) { Object validationTarget = getValidationTarget(target, context, result); Class<?> validationType = target.getBoxedType().resolve(); if (validationTarget != null) { validateAndPush(name, validationTarget, validationType); } if (context.getDepth() == 0 && !this.exceptions.isEmpty()) { throw this.exceptions.pop(); } }