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

br.com.moip.utilities.Parser Maven / Gradle / Ivy

The newest version!
package br.com.moip.utilities;

import com.fasterxml.jackson.databind.ObjectMapper;

import java.util.List;
import java.util.Map;

/**
 *
 */
public class Parser {

    /**
     * This method is used to cast a {@code Object} to {@code Map}. The main
     * objective of this method is objectToMap the objects from response Map to make possible
     * catch its attributes' values.
     *
     * @param   object
     *          {@code Object} any Object type.
     *
     * @return  {@code Map}
     */
    public Map objectToMap(Object object) {
        ObjectMapper mapper = new ObjectMapper();

        return mapper.convertValue(object, Map.class);
    }

    /**
     *
     * @param object
     * @return
     */
    public List> objectToList(Object object) {
        return (List>)object;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy