Interface Identity

All Superinterfaces:
Serializable
All Known Implementing Classes:
AbstractComposedIdentity, AbstractIdentity, AbstractSimpleIdentity, BigIntegerIdentity, LongIdentity, StringIdentity, TokenIdentity

@API(status=STABLE, since="0.1") public interface Identity extends Serializable
Interface representing the identity of a bean. Allows hiding the actual identity implementation from referencing users. The implementations of this interface must be inmutable.
Since:
0.1
Version:
1.0, 2020-05
Author:
(w) Iker Hernaez
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the identity token.
    default <T extends Identity>
    T
    resolve(@NotNull Class<T> type)
    Resolves this identity to an identity of the specified target type.
  • Method Details

    • getIdentityToken

      @NotNull @ValidIdentityToken @NotNull @ValidIdentityToken String getIdentityToken()
      Returns the identity token. This token must be unique among non equal instances of the same type of tokens.
      Returns:
      The identity token
    • resolve

      @NotNull default <T extends Identity> T resolve(@NotNull @NotNull Class<T> type)
      Resolves this identity to an identity of the specified target type.
      Type Parameters:
      T - The target identity type
      Parameters:
      type - The target identity type
      Returns:
      An instance of target identity type
      Throws:
      UnrecognizedIdentityTokenException - If this identity's token cannot be resolved to target identity type