org.springframework.data.mapping

## Interface IdentifierAccessor

All Known Implementing Classes:
  IdPropertyIdentifierAccessor, TargetAwareIdentifierAccessor

    public interface IdentifierAccessor

Interface for a component allowing the access of identifier values.

Author:
  Oliver Gierke, Mark Paluch
See Also:
  `TargetAwareIdentifierAccessor`

### Method Summary

All Methods Instance Methods Abstract Methods Default Methods
`Object` `getIdentifier()` Returns the value of the identifier.
`default Object` `getRequiredIdentifier()` Returns the identifier of the underlying instance.

### Method Detail

#### getIdentifier

    @Nullable
    Object getIdentifier()

Returns the value of the identifier.

Returns:
  the identifier of the underlying instance.

#### getRequiredIdentifier

    default Object getRequiredIdentifier()

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.

Returns:
  the identifier of the underlying instance
Throws:
  `IllegalStateException` - in case no identifier could be retrieved.
Since:
  2.0