Open Kilda Java Documentation
Metric.java
Go to the documentation of this file.
1 /* Copyright 2017 Telstra Open Source
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 package org.openkilda.messaging.model;
17 
18 import com.fasterxml.jackson.annotation.JsonCreator;
19 import com.fasterxml.jackson.annotation.JsonInclude;
20 import com.fasterxml.jackson.annotation.JsonProperty;
21 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
22 import com.google.common.base.MoreObjects;
23 
24 import java.util.List;
25 import java.util.Map;
26 import java.util.Objects;
27 
31 @JsonSerialize
32 @JsonInclude(JsonInclude.Include.NON_NULL)
33 public class Metric {
37  private static final long serialVersionUID = 1L;
38 
42  @JsonProperty("metric")
43  private String metric;
44 
48  @JsonProperty("tags")
49  private Map<Object, Object> tags;
50 
54  @JsonProperty("aggregateTags")
55  private List<String> aggregateTags;
56 
60  @JsonProperty("dps")
61  private Map<String, Long> dps;
62 
66  public Metric() {
67  }
68 
77  @JsonCreator
78  public Metric(@JsonProperty("metric") String metric,
79  @JsonProperty("tags") Map<Object, Object> tags,
80  @JsonProperty("aggregateTags") List<String> aggregateTags,
81  @JsonProperty("dps") Map<String, Long> dps) {
82  this.metric = metric;
83  this.tags = tags;
84  this.aggregateTags = aggregateTags;
85  this.dps = dps;
86  }
87 
93  public String getMetric() {
94  return metric;
95  }
96 
102  public void setMetric(String metric) {
103  this.metric = metric;
104  }
105 
111  public Map<Object, Object> getTags() {
112  return tags;
113  }
114 
120  public void setTags(Map<Object, Object> tags) {
121  this.tags = tags;
122  }
123 
129  public List<String> getAggregateTags() {
130  return aggregateTags;
131  }
132 
138  public void setAggregateTags(List<String> aggregateTags) {
139  this.aggregateTags = aggregateTags;
140  }
141 
147  public Map<String, Long> getDps() {
148  return dps;
149  }
150 
156  public void setDps(Map<String, Long> dps) {
157  this.dps = dps;
158  }
159 
163  @Override
164  public boolean equals(Object object) {
165  if (this == object) {
166  return true;
167  }
168  if (object == null || getClass() != object.getClass()) {
169  return false;
170  }
171 
172  Metric that = (Metric) object;
173  return Objects.equals(getMetric(), that.getMetric()) &&
174  Objects.equals(getTags(), that.getTags()) &&
175  Objects.equals(getAggregateTags(), that.getAggregateTags()) &&
176  Objects.equals(getDps(), that.getDps());
177  }
178 
182  @Override
183  public int hashCode() {
184  return Objects.hash(getMetric(), getTags(), getAggregateTags(), getDps());
185  }
186 
190  @Override
191  public String toString() {
192  return MoreObjects.toStringHelper(this)
193  .add("metric", metric)
194  .add("tags", tags)
195  .add("aggregateTags", aggregateTags)
196  .add("dps", dps)
197  .toString();
198  }
199 }
void setAggregateTags(List< String > aggregateTags)
Definition: Metric.java:138
void setDps(Map< String, Long > dps)
Definition: Metric.java:156
Map< String, Long > getDps()
Definition: Metric.java:147
void setMetric(String metric)
Definition: Metric.java:102
Metric(@JsonProperty("metric") String metric, @JsonProperty("tags") Map< Object, Object > tags, @JsonProperty("aggregateTags") List< String > aggregateTags, @JsonProperty("dps") Map< String, Long > dps)
Definition: Metric.java:78
Map< Object, Object > getTags()
Definition: Metric.java:111
boolean equals(Object object)
Definition: Metric.java:164
void setTags(Map< Object, Object > tags)
Definition: Metric.java:120