Package org.fuin.ddd4j.ddd
Class EntityIdConverter
-
-
Constructor Summary
Constructors Constructor Description EntityIdConverter(EntityIdFactory factory)Constructor with factory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EntityIdadaptFromJson(String str)StringadaptToJson(EntityId obj)StringfromVO(EntityId value)Converts the value object into a String.booleanisValid(String value)Verifies that the given value can be converted into a value object using the factory.Stringmarshal(EntityId value)voidrequireArgValid(@NotNull String name, @NotNull String value)Verifies if the argument is valid and throws an exception if this is not the case.EntityIdtoVO(String value)Converts a string into an entity identifier.EntityIdunmarshal(String value)
-
-
-
Constructor Detail
-
EntityIdConverter
public EntityIdConverter(EntityIdFactory factory)
Constructor with factory.- Parameters:
factory- Factory to use.
-
-
Method Detail
-
isValid
public final boolean isValid(String value)
Verifies that the given value can be converted into a value object using the factory. Anullparameter will returntrue.- Parameters:
value- Value to check.- Returns:
trueif the value can be converted, elsefalse.
-
requireArgValid
public final 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.
-
toVO
public final EntityId toVO(String value)
Converts a string into an entity identifier. Anullparameter will returnnull.- Parameters:
value- Representation of the entity identifier as string.- Returns:
- Value object.
-
fromVO
public final String fromVO(EntityId value)
Converts the value object into a String. Anullparameter will returnnull.- Parameters:
value- Value object.- Returns:
- Base type.
-
-