org.springframework.data.auditing

## Class IsNewAwareAuditingHandler

- java.lang.Object
- - org.springframework.data.auditing.AuditingHandlerSupport
  - - org.springframework.data.auditing.AuditingHandler
    - - org.springframework.data.auditing.IsNewAwareAuditingHandler

All Implemented Interfaces:
  InitializingBean

    public class IsNewAwareAuditingHandler
    extends AuditingHandler

`AuditingHandler` extension that uses `PersistentEntity.isNew(Object)` to expose a generic `#markAudited(Optional)` method that will route calls to `#markCreated(Optional)` or `#markModified(Optional)` based on the `IsNewStrategy` determined from the factory.

Since:
  1.5
Author:
  Oliver Gierke, Christoph Strobl

### Constructor Summary

Constructors
Constructor and Description
`IsNewAwareAuditingHandler(MappingContext<? extends PersistentEntity<?,?>,? extends PersistentProperty<?>> mappingContext)` Deprecated. use `IsNewAwareAuditingHandler(PersistentEntities)` instead.
`IsNewAwareAuditingHandler(PersistentEntities entities)` Creates a new `IsNewAwareAuditingHandler` for the given `MappingContext`.

### Method Summary

All Methods Instance Methods Concrete Methods
`Object` `markAudited(Object object)` Marks the given object created or modified based on `PersistentEntity.isNew(Object)`.

### Methods inherited from class org.springframework.data.auditing.AuditingHandler

`afterPropertiesSet, markCreated, markModified, setAuditorAware`

### Methods inherited from class org.springframework.data.auditing.AuditingHandlerSupport

`isAuditable, setDateTimeForNow, setDateTimeProvider, setModifyOnCreation`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### IsNewAwareAuditingHandler

    @Deprecated
    public IsNewAwareAuditingHandler(MappingContext<? extends PersistentEntity<?,?>,? extends PersistentProperty<?>> mappingContext)

Deprecated. use `IsNewAwareAuditingHandler(PersistentEntities)` instead.
Creates a new `IsNewAwareAuditingHandler` for the given `MappingContext`.

Parameters:
  `mappingContext` - must not be null.
Since:
  1.8

#### IsNewAwareAuditingHandler

    public IsNewAwareAuditingHandler(PersistentEntities entities)

Creates a new `IsNewAwareAuditingHandler` for the given `MappingContext`.

Parameters:
  `entities` - must not be null.
Since:
  1.10

### Method Detail

#### markAudited

    public Object markAudited(Object object)

Marks the given object created or modified based on `PersistentEntity.isNew(Object)`. Will route the calls to `#markCreated(Optional)` and `#markModified(Optional)` accordingly.

Parameters:
  `object` - must not be null.