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

de.taimos.dvalin.notification.push.PushMessageWrapper Maven / Gradle / Ivy

There is a newer version: 1.35
Show newest version
package de.taimos.dvalin.notification.push;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import com.fasterxml.jackson.databind.ObjectMapper;

public class PushMessageWrapper {
    
    private static ObjectMapper MAPPER = new ObjectMapper();
    
    private Map payload = new HashMap<>();
    
    public void addPushMessage(PushMessage message) {
        this.payload.put(message.getType(), message);
    }
    
    public String toMessage() throws IOException {
        Map snsMessage = new HashMap<>();
        for (Map.Entry entry : this.payload.entrySet()) {
            snsMessage.put(entry.getKey(), entry.getValue().getPushMessage());
        }
        return MAPPER.writeValueAsString(snsMessage);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy