| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.dozer.stats; |
| 17 | |
|
| 18 | |
import org.apache.commons.lang3.builder.EqualsBuilder; |
| 19 | |
import org.apache.commons.lang3.builder.ReflectionToStringBuilder; |
| 20 | |
import org.apache.commons.lang3.builder.ToStringStyle; |
| 21 | |
|
| 22 | |
import java.util.concurrent.atomic.AtomicLong; |
| 23 | |
|
| 24 | |
|
| 25 | |
|
| 26 | |
|
| 27 | |
|
| 28 | |
|
| 29 | |
|
| 30 | |
|
| 31 | |
|
| 32 | |
|
| 33 | |
public class StatisticEntry { |
| 34 | |
|
| 35 | |
private final Object key; |
| 36 | 499 | private final AtomicLong value = new AtomicLong(); |
| 37 | |
|
| 38 | 499 | public StatisticEntry(Object key) { |
| 39 | 499 | this.key = key; |
| 40 | 499 | } |
| 41 | |
|
| 42 | |
public Object getKey() { |
| 43 | 5 | return key; |
| 44 | |
} |
| 45 | |
|
| 46 | |
public long getValue() { |
| 47 | 206 | return value.get(); |
| 48 | |
} |
| 49 | |
|
| 50 | |
public void increment(long value) { |
| 51 | 40020 | this.value.addAndGet(value); |
| 52 | 40020 | } |
| 53 | |
|
| 54 | |
@Override |
| 55 | |
public boolean equals(Object object) { |
| 56 | 7 | if ((this == object)) { |
| 57 | 5 | return true; |
| 58 | |
} |
| 59 | 2 | if (!(object instanceof StatisticEntry)) { |
| 60 | 0 | return false; |
| 61 | |
} |
| 62 | 2 | StatisticEntry entry = (StatisticEntry) object; |
| 63 | 2 | return new EqualsBuilder().append(this.getKey(), entry.getKey()).isEquals(); |
| 64 | |
} |
| 65 | |
|
| 66 | |
@Override |
| 67 | |
public int hashCode() { |
| 68 | 25 | return key.hashCode(); |
| 69 | |
} |
| 70 | |
|
| 71 | |
@Override |
| 72 | |
public String toString() { |
| 73 | 0 | return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE); |
| 74 | |
} |
| 75 | |
|
| 76 | |
} |