com.smoketurner.notification.api.Notification Maven / Gradle / Ivy
/**
* Copyright 2015 Smoke Turner, LLC.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package com.smoketurner.notification.api;
import io.dropwizard.jackson.JsonSnakeCase;
import java.util.Collection;
import java.util.Map;
import java.util.Objects;
import javax.annotation.concurrent.Immutable;
import org.hibernate.validator.constraints.NotEmpty;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.MoreObjects;
import com.google.common.base.Optional;
import com.google.common.collect.ComparisonChain;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Ordering;
@Immutable
@JsonSnakeCase
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public final class Notification implements Comparable {
private final Long id;
private final String idStr;
@NotEmpty
private final String category;
@NotEmpty
private final String message;
private final DateTime createdAt;
private final Boolean unseen;
private final Map properties;
private final Collection notifications;
/**
* Constructor
*
* @param id
* @param idStr
* @param category
* @param message
* @param createdAt
* @param unseen
* @param properties
* @param notifications
*/
@JsonCreator
private Notification(@JsonProperty("id") final Optional id,
@JsonProperty("id_str") final Optional idStr,
@JsonProperty("category") final String category,
@JsonProperty("message") final String message,
@JsonProperty("created_at") final Optional createdAt,
@JsonProperty("unseen") final Optional unseen,
@JsonProperty("properties") final Optional
© 2015 - 2025 Weber Informatics LLC | Privacy Policy