summaryrefslogtreecommitdiffstats
path: root/vespalog/src/main/java/com/yahoo/log/event/Count.java
blob: 4e422b3ec8c67e82b990e291b4c460119e7c244b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.log.event;

/**
 *
 * @author  <a href="mailto:borud@yahoo-inc.com">Bjorn Borud</a>
 */
public class Count extends Event {
    public Count () {
    }

    public Count (String name, double value) {
        setValue("name", name);
        setValue("value", Double.toString(value));
    }

    /**
     * Set a property.
     *
     * @param name The name of the property
     * @param value The value of the property
     */
    @Override
    public Event setValue (String name, String value) {
        if (name.equals("value")) {
            super.setValue(name, Long.toString((new Double(value)).longValue()));
        } else {
            super.setValue(name , value);
        }
        return this;
    }
}