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 Details

    • TargetAwareIdentifierAccessor

      public TargetAwareIdentifierAccessor(Object target)
  • Method Details

    • 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