aboutsummaryrefslogtreecommitdiffstats
path: root/vespalog/src/main/java/com/yahoo/log/event/Count.java
blob: 5cb5653ae0834220ce541ccfcef47a0c2a956308 (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 Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.log.event;

/**
 *
 * @author  Bjorn Borud
 */
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((Double.valueOf(value)).longValue()));
        } else {
            super.setValue(name , value);
        }
        return this;
    }
}