Interface EquipmentTypeMapper
public interface EquipmentTypeMapper
Converts
EquipmentTypeDTO to EquipmentType objects.-
Method Summary
Modifier and TypeMethodDescriptiondefault @NonNull EquipmentTypecreateEquipmentType(@NonNull EquipmentTypeDTO dto) Constructs a newEquipmentTypebased on the givenEquipmentTypeDTO.type.default @NonNull EquipmentTypeDTOcreateEquipmentTypeDTO(@NonNull EquipmentType dto) Constructs a newEquipmentTypeDTOrepresenting the givenEquipmentType.fromDto(EquipmentTypeDTO dto) Creates a properEquipmentTypeobject from the given data-transfer object.default @NonNull StringresolveType(@NonNull EquipmentType equipmentType) Returns theCODEof the givenEquipmentType.toDto(EquipmentType equipmentType) Converts the givenEquipmentTypeto a data-transfer object.
-
Method Details
-
toDto
EquipmentTypeDTO toDto(EquipmentType equipmentType) throws de.gustavblass.commons.exceptions.IllegalArgumentException Converts the givenEquipmentTypeto a data-transfer object.- Parameters:
equipmentType- The object which a new DTO shall be created from.- Returns:
- The object constructed from the given object.
- Throws:
de.gustavblass.commons.exceptions.IllegalArgumentException- SeecreateEquipmentType(EquipmentTypeDTO).
-
fromDto
Creates a properEquipmentTypeobject from the given data-transfer object.- Parameters:
dto- The data-transfer object to be converted.- Returns:
- The EquipmentType created from the DTO.
- Throws:
InvalidEquipmentException- If theEquipmentTypeDTO.typeis invalid.
-
createEquipmentTypeDTO
@NonNull default @NonNull EquipmentTypeDTO createEquipmentTypeDTO(@NonNull @NonNull EquipmentType dto) throws de.gustavblass.commons.exceptions.IllegalArgumentException Constructs a newEquipmentTypeDTOrepresenting the givenEquipmentType.- Parameters:
dto- The object that shall be converted to a data-transfer object.- Returns:
- The DTO.
- Throws:
de.gustavblass.commons.exceptions.IllegalArgumentException- SeeresolveType(EquipmentType).
-
resolveType
@NonNull default @NonNull String resolveType(@NonNull @NonNull EquipmentType equipmentType) throws de.gustavblass.commons.exceptions.IllegalArgumentException Returns theCODEof the givenEquipmentType.- Parameters:
equipmentType- The EquipmentType whose code shall be returned.- Returns:
IndividualEquipmentType.CODEif the given EquipmentType is anIndividualEquipmentTypeorCommonEquipmentType.CODEif it's aCommonEquipmentType.- Throws:
de.gustavblass.commons.exceptions.IllegalArgumentException- If the EquipmentType is neither individual nor common equipment.
-
createEquipmentType
@NonNull default @NonNull EquipmentType createEquipmentType(@NonNull @NonNull EquipmentTypeDTO dto) throws InvalidEquipmentException Constructs a newEquipmentTypebased on the givenEquipmentTypeDTO.type. Does not initialise any fields of the newly created object.- Parameters:
dto- The data-transfer object which an empty EquipmentType object shall be created from.- Returns:
- An empty EquipmentType object of the class matching the DTO's type.
- Throws:
InvalidEquipmentException- If the type is invalid.
-