// Path: src/main/java/de/fesere/hypermedia/cj/exceptions/SerializationException.java
// public class SerializationException extends RuntimeException {
// 
//     public SerializationException(String message) {
//         super(message);
//     }
// 
//     public SerializationException(String message, Throwable cause) {
//         super(message, cause);
//     }
// }


import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import de.fesere.hypermedia.cj.exceptions.SerializationException;
import java.io.IOException;
package de.fesere.hypermedia.cj.serialization;



public class Serializer {

    private final ObjectMapper mapper;

    public Serializer() {
        this(new ObjectMapperConfig().getConfiguredObjectMapper());
    }

    protected Serializer(ObjectMapper mapper) {
        this.mapper = mapper;
    }

    public <T> T deserialize(String input, Class<T> responseClass) {
        if(Wrapped.class.isAssignableFrom(responseClass)) {
            Object deserializedObject = deserializeWrapped(input);

            if(deserializedObject.getClass().isAssignableFrom(responseClass)) {
                return responseClass.cast(deserializedObject);
            }
            else {
// Path: src/main/java/de/fesere/hypermedia/cj/exceptions/SerializationException.java
// public class SerializationException extends RuntimeException {
// 
//     public SerializationException(String message) {
//         super(message);
//     }
// 
//     public SerializationException(String message, Throwable cause) {
//         super(message, cause);
//     }
// }


// Path: src/main/java/de/fesere/hypermedia/cj/serialization/Serializer.java
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import de.fesere.hypermedia.cj.exceptions.SerializationException;
import java.io.IOException;

package de.fesere.hypermedia.cj.serialization;



public class Serializer {

    private final ObjectMapper mapper;

    public Serializer() {
        this(new ObjectMapperConfig().getConfiguredObjectMapper());
    }

    protected Serializer(ObjectMapper mapper) {
        this.mapper = mapper;
    }

    public <T> T deserialize(String input, Class<T> responseClass) {
        if(Wrapped.class.isAssignableFrom(responseClass)) {
            Object deserializedObject = deserializeWrapped(input);

            if(deserializedObject.getClass().isAssignableFrom(responseClass)) {
                return responseClass.cast(deserializedObject);
            }
            else {
                throw new SerializationException("input could not be serialized to " + responseClass.getCanonicalName());