Interface Id<E>

    • Method Detail

      • getType

        Class<E> getType()
        Returns:
        the Class reflecting the type of the referenced entity. May be null if not available.
      • withType

        Id<E> withType​(Class<?> type)
        Parameters:
        type - the new value of getType(). Exact type should actually be Class<E> but this prevents simple usage. As the type can not actually be changed with this method, this should be fine.
        Returns:
        a copy of this Id with the given type or this Id itself if already satisfying.
      • withLatestVersion

        Id<E> withLatestVersion()
        Returns:
        a copy of this Id with a version of VERSION_LATEST e.g. to use the Id as regular foreign key (pointing to the latest revision and not a historic revision) or this Id itself if already satisfying.
      • getVersion

        Comparable<?> getVersion()
        Returns:
        the version of this entity. Whenever the Entity gets updated (a modification is saved and the transaction is committed), this version is increased. Typically the version is a Number starting with 0 for a new Entity that is increased whenever a modification is committed. However, it may also be an Instant. The version acts as a modification sequence for optimistic locking. On each update it will be verified that the version has not been increased already by another transaction. When linking an Entity (Id used as foreign key) the version can act as revision for auditing. If it is VERSION_LATEST (null) it points to the latest revision of the Entity. Otherwise it points to a specific historic revision of the Entity. Depending on the database technology (e.g. when using hibernate envers) the version and the revision can be semantically different. In such case a primary key can not be converted 1:1 as revisioned foreign key Id.
      • getVersionAsString

        default String getVersionAsString()
        Returns:
        the version as String for marshalling.
      • toString

        String toString()
        Overrides:
        toString in class Object
        Returns:
        the String representation of this Id. Will consist of object-id, type and revision separated with a specific separator. Segments that are null will typically be omitted in the String representation.