Package dev.orne.beans
Class AbstractIdentity
java.lang.Object
dev.orne.beans.AbstractIdentity
- All Implemented Interfaces:
Identity
,Serializable
- Direct Known Subclasses:
AbstractComposedIdentity
,AbstractSimpleIdentity
@API(status=STABLE,
since="0.1")
public abstract class AbstractIdentity
extends Object
implements Identity
Base abstract implementation for
Identity
. Manages the formatting
and parsing of identity tokens.- Since:
- 0.1
- Version:
- 1.0, 2020-05
- Author:
- (w) Iker Hernaez
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
@NotNull @ValidIdentityToken String
Returns the identity token.protected abstract String
Returns the identity token body composed from the values of this identity.protected @NotNull String
Return the identity token prefix used for instances of this identity type.int
hashCode()
protected final String
parseIdentityTokenBody
(@NotNull String token) Parses the specified identity token and returns the original identity token body used during formatting.toString()
-
Constructor Details
-
AbstractIdentity
protected AbstractIdentity()Creates a new instance.
-
-
Method Details
-
getIdentityTokenPrefix
Return the identity token prefix used for instances of this identity type. Must return same value for instances of the same class.- Returns:
- The identity token prefix for this class
-
getIdentityTokenBody
Returns the identity token body composed from the values of this identity. Equal instances must return equal identity token body.- Returns:
- The identity token body for this instance
-
parseIdentityTokenBody
protected final String parseIdentityTokenBody(@NotNull @NotNull String token) throws UnrecognizedIdentityTokenException Parses the specified identity token and returns the original identity token body used during formatting.- Parameters:
token
- The token identity- Returns:
- The original token identity body
- Throws:
UnrecognizedIdentityTokenException
- If the identity token is not recognized
-
getIdentityToken
Returns the identity token. This token must be unique among non equal instances of the same type of tokens.- Specified by:
getIdentityToken
in interfaceIdentity
- Returns:
- The identity token
-
hashCode
public int hashCode() -
equals
-
toString
-