001/*
002 * SonarQube, open source software quality management tool.
003 * Copyright (C) 2008-2014 SonarSource
004 * mailto:contact AT sonarsource DOT com
005 *
006 * SonarQube is free software; you can redistribute it and/or
007 * modify it under the terms of the GNU Lesser General Public
008 * License as published by the Free Software Foundation; either
009 * version 3 of the License, or (at your option) any later version.
010 *
011 * SonarQube is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014 * Lesser General Public License for more details.
015 *
016 * You should have received a copy of the GNU Lesser General Public License
017 * along with this program; if not, write to the Free Software Foundation,
018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
019 */
020package org.sonar.batch.protocol.input;
021
022import javax.annotation.CheckForNull;
023import javax.annotation.Nullable;
024
025public class Metric {
026
027  private final int id;
028
029  private final String key;
030
031  private final String valueType;
032
033  private final String description;
034
035  private final int direction;
036
037  private final String name;
038
039  private final boolean qualitative;
040
041  private final boolean userManaged;
042
043  private final Double worstValue;
044
045  private final Double bestValue;
046
047  private final boolean optimizedBestValue;
048
049  public Metric(int id,
050    String key,
051    String valueType,
052    @Nullable String description,
053    int direction,
054    String name,
055    boolean qualitative,
056    boolean userManaged,
057    @Nullable Double worstValue,
058    @Nullable Double bestValue,
059    boolean optimizedBestValue) {
060    this.id = id;
061    this.key = key;
062    this.valueType = valueType;
063    this.description = description;
064    this.direction = direction;
065    this.name = name;
066    this.qualitative = qualitative;
067    this.userManaged = userManaged;
068    this.worstValue = worstValue;
069    this.bestValue = bestValue;
070    this.optimizedBestValue = optimizedBestValue;
071  }
072
073  public int id() {
074    return id;
075  }
076
077  public String key() {
078    return key;
079  }
080
081  public String valueType() {
082    return valueType;
083  }
084
085  @CheckForNull
086  public String description() {
087    return description;
088  }
089
090  public int direction() {
091    return direction;
092  }
093
094  public String name() {
095    return name;
096  }
097
098  public boolean isQualitative() {
099    return qualitative;
100  }
101
102  public boolean isUserManaged() {
103    return userManaged;
104  }
105
106  @CheckForNull
107  public Double worstValue() {
108    return worstValue;
109  }
110
111  @CheckForNull
112  public Double bestValue() {
113    return bestValue;
114  }
115
116  public boolean isOptimizedBestValue() {
117    return optimizedBestValue;
118  }
119
120}