1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
| private <T> Object bindObject(ConfigurationPropertyName name, Bindable<T> target, BindHandler handler, Context context, boolean allowRecursiveBinding) { ConfigurationProperty property = findProperty(name, context); if (property == null && containsNoDescendantOf(context.getSources(), name) && context.depth != 0) { return null; } AggregateBinder<?> aggregateBinder = getAggregateBinder(target, context); if (aggregateBinder != null) { return bindAggregate(name, target, handler, context, aggregateBinder); } if (property != null) { try { return bindProperty(target, context, property); } catch (ConverterNotFoundException ex) { Object instance = bindDataObject(name, target, handler, context, allowRecursiveBinding); if (instance != null) { return instance; } throw ex; } } return bindDataObject(name, target, handler, context, allowRecursiveBinding); }
private Object bindDataObject(ConfigurationPropertyName name, Bindable<?> target, BindHandler handler, Context context, boolean allowRecursiveBinding) { if (isUnbindableBean(name, target, context)) { return null; } Class<?> type = target.getType().resolve(Object.class); if (!allowRecursiveBinding && context.isBindingDataObject(type)) { return null; } DataObjectPropertyBinder propertyBinder = (propertyName, propertyTarget) -> bind(name.append(propertyName), propertyTarget, handler, context, false, false); return context.withDataObject(type, () -> { for (DataObjectBinder dataObjectBinder : this.dataObjectBinders) { Object instance = dataObjectBinder.bind(name, target, context, propertyBinder); if (instance != null) { return instance; } } return null; }); }
|