private Optional < Object > touchAuditor ( AuditableBeanWrapper < ? > wrapper , boolean isNew ) { Assert . notNull ( wrapper , "AuditableBeanWrapper must not be null!" ) ; return auditorAware . map ( it -> { Optional < ? > auditor = it . getCurrentAuditor ( ) ; Assert . notNull ( auditor , ( ) -> String . format ( "Auditor must not be null! Returned by: %s!" , AopUtils . getTargetClass ( it ) ) ) ; auditor . filter ( __ -> isNew ) . ifPresent ( foo -> wrapper . setCreatedBy ( foo ) ) ; auditor . filter ( __ -> ! isNew || modifyOnCreation ) . ifPresent ( foo -> wrapper . setLastModifiedBy ( foo ) ) ; return auditor ; } ) ; }
Sets modifying and creating auditor . Creating auditor is only set on new auditables .