- java.lang.Object
-
- io.github.mmm.entity.id.AbstractId<E,I,Long>
-
- io.github.mmm.entity.id.AbstractVersionId<E,String>
-
- io.github.mmm.entity.id.StringVersionId<E>
-
- Type Parameters:
E
- the generic type of the identified entity.
- All Implemented Interfaces:
Id<E>
public class StringVersionId<E> extends AbstractVersionId<E,String>
Implementation ofAbstractVersionId
usingString
asprimary key
. This is the most generic type ofId
. HoweverLongVersionId
andUuidVersionId
will be more efficient.- Since:
- 1.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
StringVersionId.Factory
IdFactory
implementation.
-
Field Summary
Fields Modifier and Type Field Description static StringVersionId.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 StringVersionId(Class<E> type, String id)
The constructor.StringVersionId(Class<E> type, String id, Long version)
The constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringVersionId.Factory
getFactory()
String
getId()
static <E> StringVersionId<E>
of(Class<E> type, String id)
static <E> StringVersionId<E>
of(Class<E> type, String id, Long version)
-
Methods inherited from class io.github.mmm.entity.id.AbstractVersionId
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 StringVersionId.Factory FACTORY
- See Also:
getFactory()
-
-
Constructor Detail
-
StringVersionId
public StringVersionId(Class<E> type, String id)
The constructor.- Parameters:
type
- thetype
.id
- theprimary key
.
-
-
Method Detail
-
getId
public String getId()
- Specified by:
getId
in interfaceId<E>
- Specified by:
getId
in classAbstractId<E,String,Long>
- 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 StringVersionId.Factory getFactory()
- Specified by:
getFactory
in classAbstractId<E,String,Long>
- Returns:
- the
IdFactory
responsible for thisId
implementation.
-
of
public static <E> StringVersionId<E> of(Class<E> type, String id)
- Type Parameters:
E
- the generic type of the identified entity.- Parameters:
type
- thetype
.id
- theprimary key
.- Returns:
- the new
StringVersionId
ornull
if the givenid
wasnull
.
-
of
public static <E> StringVersionId<E> of(Class<E> type, String id, Long version)
- Type Parameters:
E
- the generic type of the identified entity.- Parameters:
type
- thetype
.id
- theprimary key
.version
- theversion
.- Returns:
- the new
StringVersionId
ornull
if the givenid
wasnull
.
-
-