File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed
src/main/java/org/springframework/data/auditing Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ public class IsNewAwareAuditingHandler extends AuditingHandler {
3636 private final PersistentEntities entities ;
3737
3838 /**
39- * Creates a new {@link IsNewAwareAuditingHandler} for the given {@link MappingContext }.
39+ * Creates a new {@link IsNewAwareAuditingHandler} for the given {@link PersistentEntities }.
4040 *
4141 * @param entities must not be {@literal null}.
4242 * @since 1.10
@@ -48,6 +48,16 @@ public IsNewAwareAuditingHandler(PersistentEntities entities) {
4848 this .entities = entities ;
4949 }
5050
51+ /**
52+ * Factory method that creates a new {@link IsNewAwareAuditingHandler} for the given {@link MappingContext}.
53+ *
54+ * @param mappingContext must not be {@literal null}.
55+ * @since 3.0
56+ */
57+ public static IsNewAwareAuditingHandler from (MappingContext <?,?> mappingContext ) {
58+ return new IsNewAwareAuditingHandler (PersistentEntities .of (mappingContext ));
59+ }
60+
5161 /**
5262 * Marks the given object created or modified based on {@link PersistentEntity#isNew(Object)}. Will route the calls to
5363 * {@link #markCreated(Object)} and {@link #markModified(Object)} accordingly.
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ public class ReactiveIsNewAwareAuditingHandler extends ReactiveAuditingHandler {
3737 private final PersistentEntities entities ;
3838
3939 /**
40- * Creates a new {@link ReactiveIsNewAwareAuditingHandler} for the given {@link MappingContext }.
40+ * Creates a new {@link ReactiveIsNewAwareAuditingHandler} for the given {@link PersistentEntities }.
4141 *
4242 * @param entities must not be {@literal null}.
4343 */
@@ -48,6 +48,16 @@ public ReactiveIsNewAwareAuditingHandler(PersistentEntities entities) {
4848 this .entities = entities ;
4949 }
5050
51+ /**
52+ * Factory method that creates a new {@link ReactiveIsNewAwareAuditingHandler} for the given {@link MappingContext}.
53+ *
54+ * @param mappingContext must not be {@literal null}.
55+ * @since 3.0
56+ */
57+ public static ReactiveIsNewAwareAuditingHandler from (MappingContext <?,?> mappingContext ) {
58+ return new ReactiveIsNewAwareAuditingHandler (PersistentEntities .of (mappingContext ));
59+ }
60+
5161 /**
5262 * Marks the given object created or modified based on {@link PersistentEntity#isNew(Object)}. Will route the calls to
5363 * {@link #markCreated(Object)} and {@link #markModified(Object)} accordingly.
You can’t perform that action at this time.
0 commit comments