|
41 | 41 | import org.springframework.data.mapping.PersistentPropertyAccessor; |
42 | 42 | import org.springframework.data.mapping.PersistentPropertyPathAccessor; |
43 | 43 | import org.springframework.data.mapping.context.MappingContext; |
44 | | -import org.springframework.data.mapping.model.*; |
| 44 | +import org.springframework.data.mapping.model.ConvertingPropertyAccessor; |
| 45 | +import org.springframework.data.mapping.model.DefaultSpELExpressionEvaluator; |
| 46 | +import org.springframework.data.mapping.model.EntityInstantiator; |
| 47 | +import org.springframework.data.mapping.model.ParameterValueProvider; |
| 48 | +import org.springframework.data.mapping.model.PersistentEntityParameterValueProvider; |
| 49 | +import org.springframework.data.mapping.model.PropertyValueProvider; |
| 50 | +import org.springframework.data.mapping.model.SimpleTypeHolder; |
| 51 | +import org.springframework.data.mapping.model.SpELContext; |
| 52 | +import org.springframework.data.mapping.model.SpELExpressionEvaluator; |
| 53 | +import org.springframework.data.mapping.model.SpELExpressionParameterValueProvider; |
45 | 54 | import org.springframework.data.projection.EntityProjection; |
46 | 55 | import org.springframework.data.projection.EntityProjectionIntrospector; |
47 | 56 | import org.springframework.data.projection.EntityProjectionIntrospector.ProjectionPredicate; |
|
61 | 70 | import org.springframework.lang.Nullable; |
62 | 71 | import org.springframework.util.Assert; |
63 | 72 | import org.springframework.util.ClassUtils; |
| 73 | +import org.springframework.util.ObjectUtils; |
64 | 74 |
|
65 | 75 | /** |
66 | 76 | * {@link org.springframework.data.relational.core.conversion.RelationalConverter} that uses a |
@@ -1139,37 +1149,15 @@ public boolean hasValue(AggregatePath path) { |
1139 | 1149 | if (value == null) { |
1140 | 1150 | return false; |
1141 | 1151 | } |
| 1152 | + |
1142 | 1153 | if (!path.isCollectionLike()) { |
1143 | 1154 | return true; |
1144 | 1155 | } |
1145 | 1156 |
|
1146 | | - if (value instanceof char[] ar) { |
1147 | | - return ar.length != 0; |
1148 | | - } |
1149 | | - if (value instanceof byte[] ar) { |
1150 | | - return ar.length != 0; |
1151 | | - } |
1152 | | - if (value instanceof short[] ar) { |
1153 | | - return ar.length != 0; |
1154 | | - } |
1155 | | - if (value instanceof int[] ar) { |
1156 | | - return ar.length != 0; |
1157 | | - } |
1158 | | - if (value instanceof long[] ar) { |
1159 | | - return ar.length != 0; |
1160 | | - } |
1161 | | - if (value instanceof float[] ar) { |
1162 | | - return ar.length != 0; |
1163 | | - } |
1164 | | - if (value instanceof double[] ar) { |
1165 | | - return ar.length != 0; |
1166 | | - } |
1167 | | - if (value instanceof Object[] ar) { |
1168 | | - return ar.length != 0; |
1169 | | - } |
1170 | | - if (value instanceof Collection<?> col) { |
1171 | | - return !col.isEmpty(); |
| 1157 | + if (value instanceof Collection<?> || value.getClass().isArray()) { |
| 1158 | + return !ObjectUtils.isEmpty(value); |
1172 | 1159 | } |
| 1160 | + |
1173 | 1161 | return true; |
1174 | 1162 | } |
1175 | 1163 |
|
@@ -1227,7 +1215,8 @@ private static class ConverterAwareSpELExpressionParameterValueProvider |
1227 | 1215 | * @param delegate must not be {@literal null}. |
1228 | 1216 | */ |
1229 | 1217 | public ConverterAwareSpELExpressionParameterValueProvider(ConversionContext context, |
1230 | | - SpELExpressionEvaluator evaluator, ConversionService conversionService, ParameterValueProvider<RelationalPersistentProperty> delegate) { |
| 1218 | + SpELExpressionEvaluator evaluator, ConversionService conversionService, |
| 1219 | + ParameterValueProvider<RelationalPersistentProperty> delegate) { |
1231 | 1220 |
|
1232 | 1221 | super(evaluator, conversionService, delegate); |
1233 | 1222 |
|
|
0 commit comments