tech.jhipster.lite.project.infrastructure.secondary.PersistedProjectAction Maven / Gradle / Ivy
package tech.jhipster.lite.project.infrastructure.secondary;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.Instant;
import java.util.Map;
import tech.jhipster.lite.project.domain.history.ProjectAction;
final class PersistedProjectAction {
private final String module;
private final Instant date;
private final Map properties;
private PersistedProjectAction(
@JsonProperty("module") String module,
@JsonProperty("date") Instant date,
@JsonProperty("properties") Map properties
) {
this.module = module;
this.date = date;
this.properties = properties;
}
static PersistedProjectAction from(ProjectAction action) {
return new PersistedProjectAction(action.module().get(), action.date(), action.parameters().get());
}
ProjectAction toDomain() {
return ProjectAction.builder().module(getModule()).date(getDate()).parameters(getProperties());
}
public String getModule() {
return module;
}
public Instant getDate() {
return date;
}
public Map getProperties() {
return properties;
}
}