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

dev.soffa.foundation.commons.Mapper Maven / Gradle / Ivy

package dev.soffa.foundation.commons;


import lombok.SneakyThrows;

import java.io.File;
import java.io.InputStream;
import java.util.List;
import java.util.Map;

public interface Mapper {

     T convert(Object data, Class type);

    String fromXml(String xmlInput);

    @SneakyThrows
     T fromXml(String xmlInput, String root, Class kind);

    String serialize(Object data);

    byte[] serializeAsBytes(Object data);

     T deserialize(String data, Class type);

     T deserialize(byte[] data, Class type);

     T deserialize(InputStream source, Class type);

    String prettyPrint(Object data);

    @SneakyThrows
    void serializeToFile(Object content, File file);

    @SneakyThrows
     Map deserializeMap(String input);

    @SneakyThrows
     Map deserializeMap(InputStream input);

    @SneakyThrows
     Map deserializeMap(InputStream input, Class type);

    @SneakyThrows
     Map deserializeMap(String input, Class type);

    @SneakyThrows
     T deserializeParametricType(String input, Class rawType, Class... parameterClasses);

    @SneakyThrows
     List deserializeList(String input, Class type);

    @SneakyThrows
     List deserializeList(InputStream input, Class type);

    @SuppressWarnings("unchecked")
     Map toMap(Object input, Class valueClass);

    default Map toMap(Object input) {
        return toMap(input, Object.class);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy