Skip to content

Commit 258aa3d

Browse files
committed
Polish Javadoc of PersistentEntity regarding iteration order of PersistentProperty instances.
Fixes #2814.
1 parent f091beb commit 258aa3d

File tree

1 file changed

+32
-19
lines changed

1 file changed

+32
-19
lines changed

src/main/java/org/springframework/data/mapping/PersistentEntity.java

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import org.springframework.util.Assert;
2525

2626
/**
27-
* Represents a persistent entity.
27+
* Represents a persistent entity. The order of the properties returned via the {@link Iterator} is not guaranteed.
2828
*
2929
* @author Oliver Gierke
3030
* @author Graeme Rocher
@@ -47,9 +47,9 @@ public interface PersistentEntity<T, P extends PersistentProperty<P>> extends It
4747
* Returns the {@link PreferredConstructor} to be used to instantiate objects of this {@link PersistentEntity}.
4848
*
4949
* @return {@literal null} in case no suitable constructor for automatic construction can be found. This usually
50-
* indicates that the instantiation of the object of that persistent entity is done through either a customer
51-
* {@link org.springframework.data.mapping.model.EntityInstantiator} or handled by custom conversion
52-
* mechanisms entirely.
50+
* indicates that the instantiation of the object of that persistent entity is done through either a
51+
* customer {@link org.springframework.data.mapping.model.EntityInstantiator} or handled by custom
52+
* conversion mechanisms entirely.
5353
* @deprecated since 3.0, use {@link #getInstanceCreatorMetadata()}.
5454
*/
5555
@Nullable
@@ -61,8 +61,8 @@ public interface PersistentEntity<T, P extends PersistentProperty<P>> extends It
6161
*
6262
* @return {@literal null} in case no suitable creation mechanism for automatic construction can be found. This
6363
* usually indicates that the instantiation of the object of that persistent entity is done through either a
64-
* customer {@link org.springframework.data.mapping.model.EntityInstantiator} or handled by custom conversion
65-
* mechanisms entirely.
64+
* customer {@link org.springframework.data.mapping.model.EntityInstantiator} or handled by custom
65+
* conversion mechanisms entirely.
6666
* @since 3.0
6767
*/
6868
@Nullable
@@ -136,17 +136,17 @@ default P getRequiredIdProperty() {
136136
}
137137

138138
/**
139-
* Returns the version property of the {@link PersistentEntity}. Can be {@literal null} in case no version property is
140-
* available on the entity.
139+
* Returns the version property of the {@link PersistentEntity}. Can be {@literal null} in case no version property
140+
* is available on the entity.
141141
*
142142
* @return the version property of the {@link PersistentEntity}.
143143
*/
144144
@Nullable
145145
P getVersionProperty();
146146

147147
/**
148-
* Returns the version property of the {@link PersistentEntity}. Can be {@literal null} in case no version property is
149-
* available on the entity.
148+
* Returns the version property of the {@link PersistentEntity}. Can be {@literal null} in case no version property
149+
* is available on the entity.
150150
*
151151
* @return the version property of the {@link PersistentEntity}.
152152
* @throws IllegalStateException if {@link PersistentEntity} does not define a {@literal version} property.
@@ -237,8 +237,8 @@ default P getPersistentProperty(Class<? extends Annotation> annotationType) {
237237
Class<T> getType();
238238

239239
/**
240-
* Returns the alias to be used when storing type information. Might be {@literal null} to indicate that there was no
241-
* alias defined through the mapping metadata.
240+
* Returns the alias to be used when storing type information. Might be {@literal null} to indicate that there was
241+
* no alias defined through the mapping metadata.
242242
*
243243
* @return
244244
*/
@@ -253,26 +253,39 @@ default P getPersistentProperty(Class<? extends Annotation> annotationType) {
253253

254254
/**
255255
* Applies the given {@link PropertyHandler} to all {@link PersistentProperty}s contained in this
256-
* {@link PersistentEntity}.
256+
* {@link PersistentEntity}. The iteration order is undefined.
257257
*
258258
* @param handler must not be {@literal null}.
259259
*/
260260
void doWithProperties(PropertyHandler<P> handler);
261261

262+
/**
263+
* Applies the given {@link SimplePropertyHandler} to all {@link PersistentProperty}s contained in this
264+
* {@link PersistentEntity}. The iteration order is undefined.
265+
*
266+
* @param handler must not be {@literal null}.
267+
*/
262268
void doWithProperties(SimplePropertyHandler handler);
263269

264270
/**
265-
* Applies the given {@link AssociationHandler} to all {@link Association} contained in this {@link PersistentEntity}.
271+
* Applies the given {@link AssociationHandler} to all {@link Association} contained in this
272+
* {@link PersistentEntity}. The iteration order is undefined.
266273
*
267274
* @param handler must not be {@literal null}.
268275
*/
269276
void doWithAssociations(AssociationHandler<P> handler);
270277

278+
/**
279+
* Applies the given {@link SimpleAssociationHandler} to all {@link Association} contained in this
280+
* {@link PersistentEntity}. The iteration order is undefined.
281+
*
282+
* @param handler must not be {@literal null}.
283+
*/
271284
void doWithAssociations(SimpleAssociationHandler handler);
272285

273286
/**
274-
* Applies the given {@link PropertyHandler} to both all {@link PersistentProperty}s as well as all inverse properties
275-
* of all {@link Association}s.
287+
* Applies the given {@link PropertyHandler} to both all {@link PersistentProperty}s as well as all inverse
288+
* properties of all {@link Association}s. The iteration order is undefined.
276289
*
277290
* @param handler must not be {@literal null}.
278291
* @since 2.5
@@ -357,7 +370,7 @@ default <A extends Annotation> A getRequiredAnnotation(Class<A> annotationType)
357370
*
358371
* @param bean must not be {@literal null}.
359372
* @throws IllegalArgumentException in case the given bean is not an instance of the typ represented by the
360-
* {@link PersistentEntity}.
373+
* {@link PersistentEntity}.
361374
* @return whether the given bean is considered a new instance.
362375
*/
363376
boolean isNew(Object bean);
@@ -373,8 +386,8 @@ default <A extends Annotation> A getRequiredAnnotation(Class<A> annotationType)
373386
boolean isImmutable();
374387

375388
/**
376-
* Returns whether the entity needs properties to be populated, i.e. if any property exists that's not initialized by
377-
* the constructor.
389+
* Returns whether the entity needs properties to be populated, i.e. if any property exists that's not initialized
390+
* by the constructor.
378391
*
379392
* @return
380393
* @since 2.1

0 commit comments

Comments
 (0)