Class AggregateRootUuid

java.lang.Object
org.fuin.ddd4j.ddd.AggregateRootUuid
All Implemented Interfaces:
Serializable, Comparable<AggregateRootUuid>, AggregateRootId, EntityId, TechnicalId, org.fuin.objects4j.vo.ValueObject, org.fuin.objects4j.vo.ValueObjectWithBaseType<UUID>

public abstract class AggregateRootUuid extends Object implements AggregateRootId, Comparable<AggregateRootUuid>, org.fuin.objects4j.vo.ValueObjectWithBaseType<UUID>
UUID based aggregate root identifier.
See Also:
  • Constructor Details

    • AggregateRootUuid

      public AggregateRootUuid(@NotNull @NotNull EntityType entityType)
      Constructor with entity type.
      Parameters:
      entityType - Entity type.
    • AggregateRootUuid

      public AggregateRootUuid(@NotNull @NotNull EntityType entityType, @NotNull @NotNull UUID uuid)
      Constructor with UUID.
      Parameters:
      entityType - Entity type.
      uuid - UUID.
  • Method Details

    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public final boolean equals(Object obj)
      Overrides:
      equals in class Object
    • compareTo

      public final int compareTo(AggregateRootUuid other)
      Specified by:
      compareTo in interface Comparable<AggregateRootUuid>
    • toString

      public final String toString()
      Overrides:
      toString in class Object
    • asString

      public final String asString()
      Description copied from interface: EntityId
      Returns the entity identifier as string.
      Specified by:
      asString in interface EntityId
      Returns:
      Entity identifier.
    • asTypedString

      public final String asTypedString()
      Description copied from interface: EntityId
      Returns the entity identifier as string with type and identifier.
      Specified by:
      asTypedString in interface EntityId
      Returns:
      Type and identifier.
    • getType

      public final EntityType getType()
      Description copied from interface: EntityId
      Returns the type represented by this identifier.
      Specified by:
      getType in interface EntityId
      Returns:
      Type of entity.
    • getBaseType

      public final Class<UUID> getBaseType()
      Specified by:
      getBaseType in interface org.fuin.objects4j.vo.ValueObjectWithBaseType<UUID>
    • asBaseType

      public final UUID asBaseType()
      Specified by:
      asBaseType in interface org.fuin.objects4j.vo.ValueObjectWithBaseType<UUID>
    • isValid

      public static boolean isValid(String value)
      Verifies that a given string can be converted into the type.
      Parameters:
      value - Value to validate.
      Returns:
      Returns true if it's a valid type else false.
    • requireArgValid

      public static void requireArgValid(@NotNull @NotNull String name, @NotNull @NotNull 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:
      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.