private Optional < TemporalAccessor > touchDate ( AuditableBeanWrapper < ? > wrapper , boolean isNew ) { Assert . notNull ( wrapper , "AuditableBeanWrapper must not be null!" ) ; Optional < TemporalAccessor > now = dateTimeProvider . getNow ( ) ; Assert . notNull ( now , ( ) -> String . format ( "Now must not be null! Returned by: %s!" , dateTimeProvider . getClass ( ) ) ) ; now . filter ( __ -> isNew ) . ifPresent ( it -> wrapper . setCreatedDate ( it ) ) ; now . filter ( __ -> ! isNew || modifyOnCreation ) . ifPresent ( it -> wrapper . setLastModifiedDate ( it ) ) ; return now ; }
Touches the auditable regarding modification and creation date . Creation date is only set on new auditables .