Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add @JsonAnySetter method to slack Event class #160

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.ramswaroop.jbot.core.slack.models;

import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
Expand All @@ -9,10 +10,13 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.HashMap;
import java.util.Map;

/**
* Created by ramswaroop on 10/06/2016.
*/
@JsonIgnoreProperties(ignoreUnknown = true)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove this? I think it's better to ignore null values.

@JsonIgnoreProperties()
public class Event {

private static final Logger logger = LoggerFactory.getLogger(Event.class);
Expand Down Expand Up @@ -83,6 +87,8 @@ public class Event {
@JsonProperty("response_metadata")
private ResponseMetadata responseMetadata;

private Map<String, Object> properties = new HashMap<>();

public int getId() {
return id;
}
Expand Down Expand Up @@ -510,4 +516,14 @@ public ResponseMetadata getResponseMetadata() {
public void setResponseMetadata(ResponseMetadata responseMetadata) {
this.responseMetadata = responseMetadata;
}

public Map<String, Object> getProperties() {
return properties;
}

@JsonAnySetter
public void setProperty(String name, Object value) {
properties.put(name, value);
}

}