Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.phonedeck.gcm4j;
  
  import java.util.HashMap;
  import java.util.List;
  import java.util.Map;
 
 
 public class GcmRequest {
 
     @JsonProperty("registration_ids")
     private List<StringregistrationIds = new ArrayList<String>();
 
     @JsonProperty("notification_key")
     private String notificationKey;
 
     @JsonProperty("notification_key_name")
     private String notificationKeyName;
 
     @JsonProperty("collapse_key")
     private String collapseKey;
 
     @JsonProperty("data")
     private Map<StringStringdata = new LinkedHashMap<StringString>();
 
     @JsonProperty("delay_while_idle")
     private boolean delayWhileIdle;
 
     @JsonProperty("time_to_live")
     private long timeToLive;
 
     @JsonProperty("restricted_package_name")
     private String restrictedPackageName;
 
     @JsonIgnore
     private String key;
 
     @JsonIgnore
     private HashMap<StringObjectattributes;

    
Allows developers to test their request without actually sending a message.
 
     @JsonProperty("dry_run")
     private boolean dryRun;
 
 
     /*
      * Chaining setters
      */
     public GcmRequest withKey(String key) {
         setKey(key);
         return this;
     }
 
     public GcmRequest withRegistrationId(String registrationId) {
         getRegistrationIds().add(registrationId);
         return this;
     }
 
     public GcmRequest withRegistrationIds(List<StringregistrationIds) {
         setRegistrationIds(registrationIds);
         return this;
     }
     
     public GcmRequest withRegistrationIds(Collection<StringregistrationIds) {
     	getRegistrationIds().addAll(registrationIds);
     	return this;
     }
 
     public GcmRequest withNotificationKey(String notificationKey) {
         setNotificationKey(notificationKey);
         return this;
     }
 
     public GcmRequest withNotificationKeyName(String notificationKeyName) {
         setNotificationKeyName(notificationKeyName);
         return this;
     }
 
     public GcmRequest withCollapseKey(String collapseKey) {
         setCollapseKey(collapseKey);
         return this;
     }
 
     public GcmRequest withDataItem(String keyString value) {
         if ( == null) {
              = new HashMap<>();
         }
         .put(keyvalue);
         return this;
     }
 
     public GcmRequest withData(Map<StringStringdata) {
        setData(data);
        return this;
    }
    public GcmRequest withDelayWhileIdle(boolean delayWhileIdle) {
        setDelayWhileIdle(delayWhileIdle);
        return this;
    }
    public GcmRequest withTimeToLive(long timeToLive) {
        setTimeToLive(timeToLive);
        return this;
    }
    public GcmRequest withRestrictedPackageName(String restrictedPackageName) {
        setRestrictedPackageName(restrictedPackageName);
        return this;
    }
    public GcmRequest withDryRun(boolean dryRun) {
        setDryRun(dryRun);
        return this;
    }
    @JsonIgnore
    public String getKey() {
        return ;
    }
    public void setKey(String key) {
        this. = key;
    }
    public void setAttribute(String nameObject value) {
        if (value == null) {
            if ( != null) {
                .remove(name);
            }
        } else {
            if ( == null) {
                 = new HashMap<>();
            }
            .put(namevalue);
        }
    }
    @JsonIgnore
    public Object getAttribute(String name) {
        if ( == null) {
            return null;
        }
        return .get(name);
    }
    @JsonIgnore
    public Map<StringObjectgetAttributes() {
        return  != null ? Collections.unmodifiableMap() : Collections.<StringObject>emptyMap();
    }
    /*
     * Getters and Setters
     */
    public List<StringgetRegistrationIds() {
        return ;
    }
    public void setRegistrationIds(List<StringregistrationIds) {
        this. = registrationIds;
    }
    public String getNotificationKey() {
        return ;
    }
    public void setNotificationKey(String notificationKey) {
        this. = notificationKey;
    }
    public String getNotificationKeyName() {
        return ;
    }
    public void setNotificationKeyName(String notificationKeyName) {
        this. = notificationKeyName;
    }
    public String getCollapseKey() {
        return ;
    }
    public void setCollapseKey(String collapseKey) {
        this. = collapseKey;
    }
    public Map<StringStringgetData() {
        return ;
    }
    public void setData(Map<StringStringdata) {
        this. = data;
    }
    public boolean isDelayWhileIdle() {
        return ;
    }
    public void setDelayWhileIdle(boolean delayWhileIdle) {
        this. = delayWhileIdle;
    }
    public long getTimeToLive() {
        return ;
    }
    public void setTimeToLive(long timeToLive) {
        this. = timeToLive;
    }
    public String getRestrictedPackageName() {
        return ;
    }
    public void setRestrictedPackageName(String restrictedPackageName) {
        this. = restrictedPackageName;
    }


    
Allows developers to test their request without actually sending a message.

Returns:
true if the request is a dry run
    public boolean isDryRun() {
        return ;
    }

    
Allows developers to test their request without actually sending a message.

Parameters:
dryRun true if the request is a dry run
    public void setDryRun(boolean dryRun) {
        this. = dryRun;
    }
New to GrepCode? Check out our FAQ X