org.springframework.data.mapping

## Class TargetAwareIdentifierAccessor

- java.lang.Object
- - org.springframework.data.mapping.TargetAwareIdentifierAccessor

All Implemented Interfaces:
  IdentifierAccessor

Direct Known Subclasses:
  IdPropertyIdentifierAccessor

    public abstract class TargetAwareIdentifierAccessor
    extends Object
    implements IdentifierAccessor

`IdentifierAccessor` that is aware of the target bean to obtain the identifier from so that it can generate a more meaningful exception in case of an absent identifier and a call to `getRequiredIdentifier()`.

Since:
  2.0
Author:
  Oliver Gierke, Mark Paluch

### Constructor Summary

Constructors
Constructor and Description
`TargetAwareIdentifierAccessor(Object target)`

### Method Summary

All Methods Instance Methods Concrete Methods
`Object` `getRequiredIdentifier()` Returns the identifier of the underlying instance.

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

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

### Methods inherited from interface org.springframework.data.mapping.IdentifierAccessor

`getIdentifier`

### Constructor Detail

#### TargetAwareIdentifierAccessor

    public TargetAwareIdentifierAccessor(Object target)

### Method Detail

#### getRequiredIdentifier

    public Object getRequiredIdentifier()

Description copied from interface: `IdentifierAccessor`
Returns the identifier of the underlying instance. Implementations are strongly recommended to extends either `TargetAwareIdentifierAccessor` or override this method to add more context to the exception being thrown in case of the absence of an identifier.

Specified by:
  `getRequiredIdentifier` in interface `IdentifierAccessor`
Returns:
  the identifier of the underlying instance