|
18 | 18 | import java.beans.PropertyDescriptor;
|
19 | 19 | import java.lang.reflect.Field;
|
20 | 20 | import java.lang.reflect.Method;
|
21 |
| -import java.util.ArrayList; |
22 |
| -import java.util.List; |
| 21 | +import java.util.Collections; |
23 | 22 | import java.util.Map;
|
24 | 23 |
|
25 | 24 | import org.springframework.core.annotation.AnnotationUtils;
|
@@ -125,23 +124,23 @@ public TypeInformation<?> getTypeInformation() {
|
125 | 124 | @Override
|
126 | 125 | public Iterable<? extends TypeInformation<?>> getPersistentEntityType() {
|
127 | 126 |
|
128 |
| - List<TypeInformation<?>> result = new ArrayList<TypeInformation<?>>(); |
129 |
| - TypeInformation<?> type = getTypeInformation(); |
130 |
| - |
131 |
| - if (type.isCollectionLike() || isMap()) { |
132 |
| - TypeInformation<?> nestedType = getTypeInformationIfNotSimpleType(getTypeInformation().getActualType()); |
133 |
| - if (nestedType != null) { |
134 |
| - result.add(nestedType); |
135 |
| - } |
136 |
| - } else if (isEntity()) { |
137 |
| - result.add(type); |
| 127 | + if (!isEntity()) { |
| 128 | + return Collections.emptySet(); |
138 | 129 | }
|
139 | 130 |
|
140 |
| - return result; |
| 131 | + TypeInformation<?> candidate = getTypeInformationIfEntityCandidate(); |
| 132 | + return candidate != null ? Collections.singleton(candidate) : Collections.<TypeInformation<?>> emptySet(); |
141 | 133 | }
|
142 | 134 |
|
143 |
| - private TypeInformation<?> getTypeInformationIfNotSimpleType(TypeInformation<?> information) { |
144 |
| - return information == null || simpleTypeHolder.isSimpleType(information.getType()) ? null : information; |
| 135 | + private TypeInformation<?> getTypeInformationIfEntityCandidate() { |
| 136 | + |
| 137 | + TypeInformation<?> candidate = information.getActualType(); |
| 138 | + |
| 139 | + if (candidate == null || simpleTypeHolder.isSimpleType(candidate.getType())) { |
| 140 | + return null; |
| 141 | + } |
| 142 | + |
| 143 | + return candidate.isCollectionLike() || candidate.isMap() ? null : candidate; |
145 | 144 | }
|
146 | 145 |
|
147 | 146 | /*
|
@@ -271,10 +270,7 @@ public boolean isArray() {
|
271 | 270 | */
|
272 | 271 | @Override
|
273 | 272 | public boolean isEntity() {
|
274 |
| - |
275 |
| - TypeInformation<?> actualType = information.getActualType(); |
276 |
| - boolean isComplexType = actualType == null ? false : !simpleTypeHolder.isSimpleType(actualType.getType()); |
277 |
| - return isComplexType && !isTransient(); |
| 273 | + return !isTransient() && getTypeInformationIfEntityCandidate() != null; |
278 | 274 | }
|
279 | 275 |
|
280 | 276 | /*
|
|
0 commit comments