- java.lang.Object
-
- io.github.mmm.entity.id.AbstractId<E,I,Instant>
-
- io.github.mmm.entity.id.AbstractInstantId<E,UUID>
-
- io.github.mmm.entity.id.UuidInstantId<E>
-
- Type Parameters:
E
- the generic type of the identified entity.
- All Implemented Interfaces:
Id<E>
public class UuidInstantId<E> extends AbstractInstantId<E,UUID>
Implementation ofAbstractInstantId
usingUUID
asprimary key
. Can be used in two scenarios:- Your data store uses
UUID
s natively as primary key (e.g. apache cassandra supports this). In such case you will always directly use aUUID
as the actual primary key. - You may need to express a link to a transient entity. Then you can temporary assign a
UUID
to the entity on the client and link it via such ID. On the server-side the actualUuidInstantId
will then be replaced with the actualID
while persisting the data.
- Since:
- 1.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
UuidInstantId.Factory
IdFactory
implementation.
-
Field Summary
Fields Modifier and Type Field Description static UuidInstantId.Factory
FACTORY
-
Fields inherited from interface io.github.mmm.entity.id.Id
PROPERTY_ID, PROPERTY_VERSION, VERSION_LATEST, VERSION_SEPARATOR
-
-
Constructor Summary
Constructors Constructor Description UuidInstantId(Class<E> type, UUID id, Instant version)
The constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description UuidInstantId.Factory
getFactory()
UUID
getId()
static <E> UuidInstantId<E>
of(Class<E> type, UUID id)
static <E> UuidInstantId<E>
of(Class<E> type, UUID id, Instant version)
-
Methods inherited from class io.github.mmm.entity.id.AbstractInstantId
getVersion
-
Methods inherited from class io.github.mmm.entity.id.AbstractId
equals, getIdAs, getType, getVersionAs, getVersionAsLong, getWithType, hashCode, parseUuid, toString, toString, withLatestVersion, withType, withVersion
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.github.mmm.entity.id.Id
getIdAsString, getVersionAsString
-
-
-
-
Field Detail
-
FACTORY
public static final UuidInstantId.Factory FACTORY
- See Also:
getFactory()
-
-
Method Detail
-
getId
public UUID getId()
- Specified by:
getId
in interfaceId<E>
- Specified by:
getId
in classAbstractId<E,UUID,Instant>
- Returns:
- the primary key of the identified
Entity
asObject
value. It is only unique for a particulartype
of an entity. - See Also:
LongVersionId
,UuidVersionId
,StringVersionId
-
getFactory
public UuidInstantId.Factory getFactory()
- Specified by:
getFactory
in classAbstractId<E,UUID,Instant>
- Returns:
- the
IdFactory
responsible for thisId
implementation.
-
of
public static <E> UuidInstantId<E> of(Class<E> type, UUID id)
- Type Parameters:
E
- the generic type of the identified entity.- Parameters:
type
- thetype
.id
- theprimary key
.- Returns:
- the new
UuidInstantId
ornull
if the givenid
wasnull
.
-
of
public static <E> UuidInstantId<E> of(Class<E> type, UUID id, Instant version)
- Type Parameters:
E
- the generic type of the identified entity.- Parameters:
type
- thetype
.id
- theprimary key
.version
- theversion
.- Returns:
- the new
UuidInstantId
ornull
if the givenid
wasnull
.
-
-