Interface TopiaIdFactory

All Superinterfaces:
Serializable
All Known Implementing Classes:
DefaultTopiaIdFactory, FullyQualifiedNamePlusUuidTopiaIdFactory, LegacyTopiaIdFactory, ShortTopiaIdFactory

public interface TopiaIdFactory extends Serializable
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.
You can change the implementation used by ToPIA by changing configuration. 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 Details

    • newTopiaId

      <E extends TopiaEntity> String newTopiaId(Class<E> entityClass, TopiaEntity topiaEntity)
      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

      <E extends TopiaEntity> String newTopiaId(Class<E> entityClass, String randomPart)
      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

      <E extends TopiaEntity> Class<E> getClassName(String topiaId)
      Type Parameters:
      E - type of the entity
      Parameters:
      topiaId - the topiaId to inspect
      Returns:
      the FQN part of the topiaId
    • getRandomPart

      String getRandomPart(String topiaId)
      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

      boolean isTopiaId(String str)
      Parameters:
      str - FIXME
      Returns:
      true if given argument is a well formatted topiaId