/** * Get given {@link PropertyBox} as a map of {@link Path} and {@link TypedExpression} values. * @param value The property box value (not null) * @param includeNullValues Whether to set <code>null</code> property box values to the <code>null</code> value * @return Values map */ @SuppressWarnings({ "unchecked", "rawtypes" }) protected Map<Path<?>, TypedExpression<?>> asPathValues(PropertyBox value, boolean includeNullValues) { ObjectUtils.argumentNotNull(value, "PropertyBox must be not null"); final Map<Path<?>, TypedExpression<?>> values = new HashMap<>(value.size()); final PathPropertyBoxAdapter propertyBoxAdapter = PathPropertyBoxAdapter.create(value); propertyBoxAdapter.paths().forEach(path -> { propertyBoxAdapter.getValueOrElse(path, pathWithNoValue -> { if (includeNullValues) { values.put(path, NullExpression.create(path)); } }).ifPresent(val -> { values.put(path, (val instanceof TypedExpression) ? (TypedExpression<?>) val : ConstantConverterExpression.create((Path) path, val)); }); }); return values; }