Interface IdFactory

All Superinterfaces:
IdResolver, IdSupplier
All Known Implementing Classes:
SimpleIdFactory

public interface IdFactory extends IdResolver, IdSupplier
IdFactory.
Author:
Werner Randelshofer
  • Method Details

    • setDocumentHome

      void setDocumentHome(@Nullable URI documentHome)
    • createId

      default @Nullable String createId(Object object)
      Creates an id for the specified object. If the object already has an id, then that id is returned.
      Parameters:
      object - the object
      Returns:
      the id
    • createId

      String createId(Object object, @Nullable String prefix)
      Creates an id for the specified object. If the object already has an id, then that id is returned.
      Parameters:
      object - the object
      prefix - the desired prefix for the id
      Returns:
      the id
    • createId

      @Nullable String createId(@NonNull Object object, @Nullable String prefix, String suggestedId)
      Creates an id for the specified object. If the object already has an id, then that id is returned. If the object has no id and the suggestedId has not been assigned to an object yet, then the suggestedId is used.
      Parameters:
      object - the object
      prefix - the prefix used to create a new id, if the suggested id is taken
      suggestedId - the suggested id
      Returns:
      the id
    • putIdAndObject

      @Nullable Object putIdAndObject(@NonNull String id, @NonNull Object object)
      Puts the id and the object for mapping between them.

      If the object already has an id, the old id is replaced.

      Parameters:
      id - the id
      object - the object
      Returns:
      the object that previously was assigned to this id
    • putIdToObject

      @Nullable Object putIdToObject(@NonNull String id, @NonNull Object object)
      Puts the id for mapping to the specified object.
      Parameters:
      id - the id
      object - the object
      Returns:
      the object that previously was assigned to this id
    • reset

      void reset()
      Clears all ids.