001package io.ebean;
002
003import java.io.Serializable;
004/**
005 * Holds a distinct value with it's count.
006 * (Used with {@link Query#findSingleAttributeList()} and {@link Query#setCountDistinct(CountDistinctOrder)}.)
007 * @author Roland Praml, FOCONIS AG
008 */
009public class CountedValue<A> implements Serializable {
010  private static final long serialVersionUID = -2267971668356749695L;
011
012  private final A value;
013  private final long count;
014
015  public CountedValue(A value, long count) {
016    this.value = value;
017    this.count = count;
018  }
019
020  public long getCount() {
021    return count;
022  }
023  
024  public A getValue() {
025    return value;
026  }
027  
028  @Override
029  public String toString() {
030    return count + ": " + value;
031  }
032  
033}