Class ServiceInfoMapper
java.lang.Object
com.nmontytskyi.monitoring.server.mapper.ServiceInfoMapper
Stateless mapper between the
RegisteredServiceEntity JPA entity
and the ServiceInfo core domain model.
Keeps the persistence layer decoupled from the domain layer. The business logic in services and schedulers works exclusively with core models; this mapper performs the translation at the boundary.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic RegisteredServiceEntitytoEntity(ServiceInfo model) Converts aServiceInfocore domain object into a newRegisteredServiceEntityready to be persisted.static ServiceInfotoModel(RegisteredServiceEntity entity) Converts aRegisteredServiceEntity(loaded from the database) into aServiceInfocore domain object.
-
Constructor Details
-
ServiceInfoMapper
public ServiceInfoMapper()
-
-
Method Details
-
toModel
Converts aRegisteredServiceEntity(loaded from the database) into aServiceInfocore domain object.- Parameters:
entity- the JPA entity to convert; must not benull- Returns:
- the corresponding domain model
-
toEntity
Converts aServiceInfocore domain object into a newRegisteredServiceEntityready to be persisted.The returned entity has no
idset (it will be assigned by the DB), and theSlaDefinitionEntityis pre-linked to the service.- Parameters:
model- the domain model to convert; must not benull- Returns:
- the JPA entity without a persisted ID
-