Interface EntityId

All Superinterfaces:
org.fuin.objects4j.common.AsStringCapable, Serializable, org.fuin.utils4j.TechnicalId
All Known Subinterfaces:
AggregateRootId
All Known Implementing Classes:
AggregateRootUuid, IntegerEntityId

public interface EntityId extends org.fuin.utils4j.TechnicalId, org.fuin.objects4j.common.AsStringCapable, Serializable
Identifies an entity within all entities of the same type.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the entity identifier as string.
    Returns the entity identifier as string with type and identifier.
    Returns the type represented by this identifier.
    static boolean
    isValid(@NotNull EntityIdFactory factory, String value)
    Verifies that the given value can be converted into a value object using the factory.
    static void
    requireArgValid(@NotNull EntityIdFactory factory, @NotNull String name, String value)
    Verifies if the argument is valid and throws an exception if this is not the case.
    static EntityId
    valueOf(@NotNull EntityIdFactory factory, String value)
    Converts a string into an entity identifier.
  • Method Details

    • getType

      EntityType getType()
      Returns the type represented by this identifier.
      Returns:
      Type of entity.
    • asString

      String asString()
      Returns the entity identifier as string.
      Specified by:
      asString in interface org.fuin.objects4j.common.AsStringCapable
      Returns:
      Entity identifier.
    • asTypedString

      String asTypedString()
      Returns the entity identifier as string with type and identifier.
      Returns:
      Type and identifier.
    • isValid

      static boolean isValid(@NotNull @NotNull EntityIdFactory factory, @Nullable String value)
      Verifies that the given value can be converted into a value object using the factory. A null parameter will return true.
      Parameters:
      factory - Factory used to create enitity identifiers.
      value - Value to check.
      Returns:
      true if the value can be converted, else false.
    • requireArgValid

      static void requireArgValid(@NotNull @NotNull EntityIdFactory factory, @NotNull @NotNull String name, @Nullable String value) throws org.fuin.objects4j.common.ConstraintViolationException
      Verifies if the argument is valid and throws an exception if this is not the case.
      Parameters:
      factory - Factory used to create enitity identifiers.
      name - Name of the value for a possible error message.
      value - Value to check.
      Throws:
      org.fuin.objects4j.common.ConstraintViolationException - The value was not valid.
    • valueOf

      static EntityId valueOf(@NotNull @NotNull EntityIdFactory factory, @Nullable String value)
      Converts a string into an entity identifier. A null parameter will return null.
      Parameters:
      factory - Factory used to create enitity identifiers.
      value - Representation of the entity identifier as string.
      Returns:
      Value object.