@ThreadSafe
public final class EntityIdConverter
extends jakarta.xml.bind.annotation.adapters.XmlAdapter<String,EntityId>
implements jakarta.json.bind.adapter.JsonbAdapter<EntityId,String>
JAXB and JSON converter for an entity identifier.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal EntityIdadaptFromJson(String str) final StringadaptToJson(EntityId obj) final StringConverts the value object into a String.final booleanVerifies that the given value can be converted into a value object using the factory.final Stringfinal voidrequireArgValid(@NotNull String name, @NotNull String value) Verifies if the argument is valid and throws an exception if this is not the case.final EntityIdConverts a string into an entity identifier.final EntityId
-
Constructor Details
-
EntityIdConverter
Constructor with factory.- Parameters:
factory- Factory to use.
-
-
Method Details
-
isValid
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.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.
-
toVO
Converts a string into an entity identifier. Anullparameter will returnnull.- Parameters:
value- Representation of the entity identifier as string.- Returns:
- Value object.
-
fromVO
Converts the value object into a String. Anullparameter will returnnull.- Parameters:
value- Value object.- Returns:
- Base type.
-
marshal
-
unmarshal
-
adaptToJson
-
adaptFromJson
-