All Downloads are FREE. Search and download functionalities are using the official Maven repository.

website.automate.waml.io.mappers.ActionMapper Maven / Gradle / Ivy

The newest version!
package website.automate.waml.io.mappers;

import com.fasterxml.jackson.databind.ObjectMapper;
import website.automate.waml.io.model.main.action.Action;

public class ActionMapper {

    private ObjectMapper objectMapper;

    public ActionMapper(ObjectMapper objectMapper) {
        this.objectMapper = objectMapper;
    }

    @SuppressWarnings("unchecked")
    public  T map(T action) {
        try {
            return (T) objectMapper.readValue(objectMapper.writeValueAsString(action),
                    action.getClass());
        } catch (Exception e) {
            throw new RuntimeException("Can't map action!", e);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy