Package org.nuiton.topia.persistence
Interface TopiaIdFactory
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
DefaultTopiaIdFactory,FullyQualifiedNamePlusUuidTopiaIdFactory,LegacyTopiaIdFactory,ShortTopiaIdFactory
This contract represents a topiaId generation strategy.
It can be used in both ways :
- generate a new topiaId from a given class;
- retrieves a class or random part from a given topiaId.
Serializable must be implemented because
TopiaConfiguration may hold some references.- Since:
- 3.0
- Author:
- Brendan Le Ny - bleny@codelutin.com, Tony Chemit - tchemit@codelutin.com
- See Also:
-
Method Summary
Modifier and TypeMethodDescription<E extends TopiaEntity>
Class<E>getClassName(String topiaId) getRandomPart(String topiaId) boolean<E extends TopiaEntity>
StringnewTopiaId(Class<E> entityClass, String randomPart) Builds a new topiaId for the given entity type and the given random part.<E extends TopiaEntity>
StringnewTopiaId(Class<E> entityClass, TopiaEntity topiaEntity) Generates a new topiaId for the given entity type and the given entity.
-
Method Details
-
newTopiaId
Generates a new topiaId for the given entity type and the given entity.- Type Parameters:
E- type of entity- Parameters:
entityClass- type of entity (must be a not null interface)topiaEntity- the entity on which we want to generate the id (must be not null)- Returns:
- the new topiaId for the given entity
-
newTopiaId
Builds a new topiaId for the given entity type and the given random part.- Type Parameters:
E- type of entity- Parameters:
entityClass- type of entity (must be a not null interface)randomPart- the random part of the topiaId- Returns:
- the new topiaId
-
getClassName
- Type Parameters:
E- type of the entity- Parameters:
topiaId- the topiaId to inspect- Returns:
- the FQN part of the topiaId
-
getRandomPart
- Parameters:
topiaId- the topiaId to inspect- Returns:
- the random part of the topiaId
-
getSeparator
String getSeparator()- Returns:
- the separator between the FQN and the random part of any topiaId.
-
isTopiaId
- Parameters:
str- FIXME- Returns:
- true if given argument is a well formatted topiaId
-