Package org.fuin.ddd4j.ddd
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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AggregateRootUuid(@NotNull EntityType entityType)Constructor with entity type.AggregateRootUuid(@NotNull EntityType entityType, @NotNull UUID uuid)Constructor with UUID.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description UUIDasBaseType()StringasString()Returns the entity identifier as string.StringasTypedString()Returns the entity identifier as string with type and identifier.intcompareTo(AggregateRootUuid other)booleanequals(Object obj)Class<UUID>getBaseType()EntityTypegetType()Returns the type represented by this identifier.inthashCode()static booleanisValid(String value)Verifies that a given string can be converted into the type.static voidrequireArgValid(@NotNull String name, @NotNull String value)Verifies if the argument is valid and throws an exception if this is not the case.StringtoString()
-
-
-
Constructor Detail
-
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 Detail
-
compareTo
public final int compareTo(AggregateRootUuid other)
- Specified by:
compareToin interfaceComparable<AggregateRootUuid>
-
asString
public final String asString()
Description copied from interface:EntityIdReturns the entity identifier as string.
-
asTypedString
public final String asTypedString()
Description copied from interface:EntityIdReturns the entity identifier as string with type and identifier.- Specified by:
asTypedStringin interfaceEntityId- Returns:
- Type and identifier.
-
getType
public final EntityType getType()
Description copied from interface:EntityIdReturns the type represented by this identifier.
-
getBaseType
public final Class<UUID> getBaseType()
- Specified by:
getBaseTypein interfaceorg.fuin.objects4j.vo.ValueObjectWithBaseType<UUID>
-
asBaseType
public final UUID asBaseType()
- Specified by:
asBaseTypein interfaceorg.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
trueif it's a valid type elsefalse.
-
requireArgValid
public static void requireArgValid(@NotNull @NotNull String name, @NotNull @NotNull String value) throws org.fuin.objects4j.common.ConstraintViolationExceptionVerifies 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.
-
-