初始化

This commit is contained in:
谢洪龙
2017-08-23 12:20:15 +08:00
commit 491d430741
471 changed files with 16355 additions and 0 deletions
@@ -0,0 +1,87 @@
package com.ifish.jpush.push.model.notification;
import java.util.Map;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
public class WinphoneNotification extends PlatformNotification {
private static final String NOTIFICATION_WINPHONE = "winphone";
private static final String TITLE = "title";
private static final String _OPEN_PAGE = "_open_page";
private final String title;
private final String openPage;
private WinphoneNotification(Object alert, String title, String openPage,
Map<String, String> extras,
Map<String, Number> numberExtras,
Map<String, Boolean> booleanExtras,
Map<String, JsonObject> jsonExtras) {
super(alert, extras, numberExtras, booleanExtras, jsonExtras);
this.title = title;
this.openPage = openPage;
}
public static Builder newBuilder() {
return new Builder();
}
public static WinphoneNotification alert(String alert) {
return newBuilder().setAlert(alert).build();
}
@Override
public String getPlatform() {
return NOTIFICATION_WINPHONE;
}
@Override
public JsonElement toJSON() {
JsonObject json = super.toJSON().getAsJsonObject();
if (null != title) {
json.add(TITLE, new JsonPrimitive(title));
}
if (null != openPage) {
json.add(_OPEN_PAGE, new JsonPrimitive(openPage));
}
return json;
}
public static class Builder extends PlatformNotification.Builder<WinphoneNotification, Builder> {
private String title;
private String openPage;
protected Builder getThis() {
return this;
}
public Builder setTitle(String title) {
this.title = title;
return this;
}
public Builder setOpenPage(String openPage) {
this.openPage = openPage;
return this;
}
public Builder setAlert(Object alert) {
this.alert = alert;
return this;
}
public WinphoneNotification build() {
return new WinphoneNotification(alert, title, openPage,
extrasBuilder, numberExtrasBuilder, booleanExtrasBuilder, jsonExtrasBuilder);
}
}
}