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

com.authy.api.Formattable Maven / Gradle / Ivy

package com.authy.api;

import org.json.JSONObject;

import java.util.Map;

/**
 * Interface to represent objects as XML or Java's Map
 *
 * @author Authy Inc
 */
public interface Formattable {
    String toXML();

    Map toMap();

    default String toJSON() {
        JSONObject json = new JSONObject();
        for (Map.Entry entry : toMap().entrySet()) {
            json.put(entry.getKey(), entry.getValue());
        }

        return json.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy