com.windowsazure.messaging.InstallationTemplate Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of NotificationHubs Show documentation
Show all versions of NotificationHubs Show documentation
This package contains the JAVA SDK for Azure Notification Hubs.
The newest version!
package com.windowsazure.messaging;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.io.IOUtils;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
public class InstallationTemplate {
private String body;
private Map headers;
private String expiry;
private List tags;
public InstallationTemplate(){
this(null);
}
public InstallationTemplate(String body){
this(body, null);
}
public InstallationTemplate(String body, String tag){
this.body = body;
if(tag != null){
this.addTag(tag);
}
}
public String getBody() {
return body;
}
public void setBody(String body) {
this.body = body;
}
public Map getHeaders() {
return headers;
}
public void addHeader(String headerName, String headerValue){
if(this.headers == null){
this.headers = new HashMap();
}
this.headers.put(headerName, headerValue);
}
public String getExpiry() {
return expiry;
}
public void setExpiry(String expiry) {
this.expiry = expiry;
}
public List getTags() {
return tags;
}
public void addTag(String tag) {
if(this.tags == null){
this.tags = new ArrayList();
}
this.tags.add(tag);
}
public static InstallationTemplate fromJson(String json){
return new Gson().fromJson(json, InstallationTemplate.class);
}
public static Installation fromJson(InputStream json) throws IOException{
return Installation.fromJson(IOUtils.toString(json));
}
public String toJson(){
return new GsonBuilder().disableHtmlEscaping().create().toJson(this);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy